2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Tanshu.Accounts.BI;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
using Tanshu.Accounts.Helpers;
|
|
|
|
|
using Tanshu.Accounts.PointOfSale.Updates;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
|
|
|
|
public partial class MainForm : Form
|
|
|
|
|
{
|
|
|
|
|
public MainForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void advancesToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
if (roleBI.IsAllowed)
|
2011-01-06 07:17:00 +00:00
|
|
|
|
{
|
|
|
|
|
using (RecieveAdvanceForm frm = new RecieveAdvanceForm())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void paymentsToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
{
|
|
|
|
|
using (AdjustAdvanceForm frm = new AdjustAdvanceForm())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createNewUserToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SECURITY_MANAGE_ROLES))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (SelectUser form = new SelectUser(new UserBI().GetFilteredUsers, true))
|
|
|
|
|
{
|
|
|
|
|
form.userEvent += new UserEventHandler(form_userEvent);
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UserBO form_userEvent(object sender, UserEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UserBO user = e.User;
|
|
|
|
|
|
|
|
|
|
if (user == null)
|
|
|
|
|
{
|
|
|
|
|
using (UserForm form = new UserForm(null))
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
using (UserForm form = new UserForm(user.UserID))
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
e.Handled = true;
|
|
|
|
|
return new UserBO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (ChangePassword frm = new ChangePassword())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assignRolesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SECURITY_MANAGE_ROLES))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (AssignRoles frm = new AssignRoles())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void paymentsToolStripMenuItem1_Click_1(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
using (PaymentForm frm = new PaymentForm())
|
|
|
|
|
{
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void salesAnalysisToolStripMenuItem1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALE_DETAIL))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (frmSaleAnalysisForm frm = new frmSaleAnalysisForm())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cashierCheckoutToolStripMenuItem1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_CHECKOUT))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (Cashier_Checkout_Form frm = new Cashier_Checkout_Form())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void customersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//Guid c=new Guid("28BFB512-6B92-4AA1-A931-7993593B8E07");
|
|
|
|
|
using (CustomersForm Customer = new CustomersForm(null, ""))
|
|
|
|
|
{
|
|
|
|
|
Customer.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void productsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_PRODUCTS))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (ProductsForm frm = new ProductsForm())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void prToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ProductTypes ProductType = new ProductTypes();
|
|
|
|
|
ProductType.ShowDialog();
|
|
|
|
|
ProductType.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void viewLogToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.LOG_VIEW))
|
|
|
|
|
{
|
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (LogViewerForm frm = new LogViewerForm())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void updateToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
|
|
|
|
|
{
|
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (UpdateForm frm = new UpdateForm())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void reportToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (SaleTaxReportForm frm = new SaleTaxReportForm())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void updateBillsToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
|
|
|
|
|
{
|
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (UpdateSales frm = new UpdateSales())
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void autoToolStripMenuItem_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
|
|
|
|
using (ReplaceForm frm = new ReplaceForm())
|
|
|
|
|
frm.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void btnLogin_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
ILogin login = new KeyboardLogin();
|
|
|
|
|
if (!Session.IsAuthenticated)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (login.LoginUser())
|
|
|
|
|
{
|
|
|
|
|
this.Text = "Main Menu - User: " + Session.User.Name;
|
|
|
|
|
btnLogin.Text = "Logout";
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
login.LogoutUser();
|
|
|
|
|
this.Text = "Main Menu - Login";
|
|
|
|
|
btnLogin.Text = "Login";
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 07:17:00 +00:00
|
|
|
|
private void btnSale_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-06 07:17:00 +00:00
|
|
|
|
if (roleBI.IsAllowed)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-22 12:38:30 +00:00
|
|
|
|
ProductBI.UpdateShortName();
|
2011-01-10 19:49:11 +00:00
|
|
|
|
using (SalesForm frmSale = new SalesForm(new BillController()))
|
2011-01-06 07:17:00 +00:00
|
|
|
|
frmSale.ShowDialog();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|