Beispiel #1
0
        void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                Button       btntag = (Button)sender;
                PrinterModel item   = (PrinterModel)btntag.Tag;
                item.Status     = 0;
                item.UpdateBy   = userid;
                item.UpdateDate = DateTime.Now;
                int result = PrinterService.UpdatePrinter(item);

                var messenger = "Delete " + item.PrintName + " fail. ";
                if (result == 1)
                {
                    messenger = "Delete " + item.PrintName + " successful. ";
                    LoadDataOfPrinter();
                    pDetail.Controls.Clear();
                }
                frmMessager frm = new frmMessager("Messenger", messenger);
                frmOpacity.ShowDialog(this, frm);
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPrinterSetting:::::::::::::::::::btnRemove_Click::::::::::::::::" + ex.Message);
            }
        }
Beispiel #2
0
        void btnRemovePrinterJob_Click(object sender, EventArgs e)
        {
            try
            {
                Button        btntag = (Button)sender;
                PrintJobModel item   = (PrintJobModel)btntag.Tag;
                if (item != null)
                {
                    item.UpdateBy = userid;

                    var result = PrinterService.RemoveDataPrinterJob(item);

                    var messenger = "Remove printe job fail. ";
                    if (result > 0)
                    {
                        messenger = "Remove printe job successful. ";
                        LoadPriterJob();
                        pDetail.Controls.Clear();
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
            catch (Exception ex)
            {
                frmMessager frm = new frmMessager("Messenger", "Please remove again.");
                frmOpacity.ShowDialog(this, frm);
                LogPOS.WriteLog("frmPrinterSetting:::::::::::::::::::btnRemovePrinterJob_Click::::::::::::::::" + ex.Message);
            }
        }
Beispiel #3
0
        void btnDeleteDepartment_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete Role ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button          btnDelete = (Button)sender;
                DepartmentModel data      = (DepartmentModel)(btnDelete.Tag);

                if (data.DepartmentID > 0)
                {
                    var result    = UserService.RemoveDepartment(data.DepartmentID, userid);
                    var messenger = "Delete role fail.";
                    if (result == 1)
                    {
                        addDepartmentList("User Role", 1);
                        pDetail.Controls.Clear();
                        messenger = "Delete role successful.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #4
0
 void ucTable_Click(object sender, EventArgs e)
 {
     try
     {
         UCTable ucTable = (UCTable)sender;
         if (ucTable.BackColor == Color.FromArgb(0, 204, 15))
         {
             ucTable.BackColor = Color.FromArgb(242, 242, 242);
         }
         else
         {
             if (ucTable.Tag != null)
             {
                 if (ucTable.BackColor == Color.FromArgb(0, 102, 204))
                 {
                     frmMessager frm = new frmMessager("Join Table", "Table waitting print BILL");
                     frmOpacity.ShowDialog(this, frm);
                 }
                 else
                 {
                     ucTable.BackColor = Color.FromArgb(0, 204, 15);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("frmJoinTable:::::::::::::::::::::ucTable_Click::::::::::::::::" + ex.Message);
     }
 }
Beispiel #5
0
        private void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                Form1 frmLogin = new Form1();
                frmLogin.CheckCallform = 1;

                if (frmLogin.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Button SettingAll   = (Button)sender;
                    var    menuid       = Convert.ToInt32(SettingAll.Tag);
                    var    departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
                    var    result       = PermissionService.GetPermissionByDepartment(departmentid, menuid);
                    // frmReport frm = new frmReport();
                    //// this.Close();
                    // frm.ShowDialog();
                    if (result > 0)
                    {
                        frmReport frm = new frmReport();

                        frm.ShowDialog();
                        frmLogin.CheckCallform = 0;
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
                        frmOpacity.ShowDialog(this, frm);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemLog.LogPOS.WriteLog("frmMain::::::::::::::::::::::::::::::btnReport_Click:::::::::::::::::::::::::" + ex.Message);
            }
        }
Beispiel #6
0
 private void btnSettingAll_Click(object sender, EventArgs e)
 {
     try
     {
         Button SettingAll   = (Button)sender;
         var    menuid       = Convert.ToInt32(SettingAll.Tag);
         var    departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
         var    result       = PermissionService.GetPermissionByDepartment(departmentid, menuid);
         //frmSettingAll frm = new frmSettingAll();
         //frm.ShowDialog();
         if (result > 0)
         {
             frmSettingAll frm = new frmSettingAll();
             frm.ShowDialog();
         }
         else
         {
             frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
             frmOpacity.ShowDialog(this, frm);
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("frmMain::::::::::::::::::::::::btnSettingAll_Click:::::::::::::::::::" + ex.Message);
     }
 }
Beispiel #7
0
        void ucMenuList_btnRemove_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this menu ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button         btnRemove = (Button)sender;
                CatalogueModel tag       = (CatalogueModel)(btnRemove.Tag);
                if (tag.CatalogueID > 0)
                {
                    var result = CatalogeService.RemoveCatalogue(tag.CatalogueID, 0);
                    if (result == 1)
                    {
                        addMenuList("Menu List", 1);
                        pnDetail.Controls.Clear();
                        frmMessager frm = new frmMessager("Messenger", "Delete menu successful.");
                        frmOpacity.ShowDialog(this, frm);
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("Messenger", "Delete menu fail.");
                        frmOpacity.ShowDialog(this, frm);
                    }
                }
            }
        }
Beispiel #8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var data = ShiftService.GetListShiftHistoryByUserid(userid, 0).ToList().FirstOrDefault();

            if (data != null)
            {
                frmMessager frm = new frmMessager("Warning", "Only one working period can be used. To create a new working period, please end the current.");
                frm.ShowDialog();
                //if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                //{
                //    UserLoginModel.ShiffID = data.ShiftHistoryID;
                //}
            }
            else
            {
                frmNewShift frm = new frmNewShift();
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    addOnDutyList("On Duty", 1);
                    frm.Close();
                }
            }
        }
Beispiel #9
0
        void ucGroupList_btnRemove_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this group ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button        btnRemoveGroup = (Button)sender;
                CategoryModel tag            = (CategoryModel)(btnRemoveGroup.Tag);
                if (tag.CategoryID > 0)
                {
                    var result   = CatalogeService.RemoveCategory(tag.CategoryID, 0);
                    var messenge = "";
                    if (result == 1)
                    {
                        addGroupList("Group List", 2, this.CurrentPage);
                        pnDetail.Controls.Clear();
                        messenge = "Remove group successful.";
                    }
                    else
                    {
                        messenge = "Remove group fail.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenge);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #10
0
        void btnDeleteUser_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete user ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button     btnDelete = (Button)sender;
                StaffModel data      = (StaffModel)(btnDelete.Tag);

                if (data.StaffID > 0)
                {
                    var result    = UserService.RemoveStaff(data.StaffID, userid);
                    var messenger = "Delete user fail.";
                    if (result == 1)
                    {
                        addUserList("User List", 2);
                        pDetail.Controls.Clear();
                        messenger = "Delete user successful.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #11
0
        private void frmEndShift_Load(object sender, EventArgs e)
        {
            userid = UserLoginModel.UserLoginInfo.StaffID;

            var modelShift = ShiftService.GetListShiftHistoryByUserid(userid, 0).FirstOrDefault();

            if (userid == 0)
            {
                Form1 frm = new Form1();
                this.Close();
                frm.ShowDialog();
            }
            else
            {
                if (modelShift != null)
                {
                    MoneyFortmat Fomat = new MoneyFortmat(1);
                    shiftid = modelShift.ShiftHistoryID;

                    this.txtShiftName.Text = modelShift.ShiftName ?? "";
                    this.txtStaffName.Text = modelShift.UserName ?? "";
                    this.txtStartTime.Text = (modelShift.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture);
                    this.txtCashStart.Text = Fomat.getValue(modelShift.CashStart ?? 0).ToString("C");
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Please create new shift. ");
                    this.Close();
                    frm.ShowDialog();
                }
            }
        }
Beispiel #12
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            try
            {
                frmChooseeTableJoin frm = new frmChooseeTableJoin();
                string lineOldTableNo   = string.Empty;
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (frm.TableNo < 40)
                    {
                        TableNew = frm.TableNo + "";
                        foreach (Control ctr in flpJoinTable.Controls)
                        {
                            UCTable ucTableJoin = (UCTable)ctr;
                            if (ucTableJoin.BackColor == Color.FromArgb(0, 204, 15))
                            {
                                StatusTable         st        = (StatusTable)ucTableJoin.Tag;
                                OrderJoinTableModel JoinTable = new OrderJoinTableModel();
                                JoinTable.OrderID       = st.OrderID;
                                JoinTable.TableID       = Convert.ToInt32(st.TableID);
                                JoinTable.SubTotalTable = Convert.ToDouble(st.SubTotal);
                                JoinTable.TableIDNew    = frm.TableNo;
                                JoinTable.OrderNumber   = st.OrderNum;
                                lstJoinTable.Add(JoinTable);
                            }
                        }
                        if (lstJoinTable.Count > 0)
                        {
                            int result = OrderService.JoinTable(lstJoinTable);
                            if (result == 1)
                            {
                                GetListPrinter();
                                foreach (PrinterModel item in PrintData)
                                {
                                    Header = item.Header;
                                    posPrinter.SetPrinterName(item.PrinterName);
                                    posPrinter.printDocument.PrintPage += printDocument_PrintPage;
                                    posPrinter.Print();
                                }

                                this.Close();
                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            }
                        }
                    }
                    else
                    {
                        frmMessager frmmes = new frmMessager("Join Table", "TableNo is unavailable");
                        frmOpacity.ShowDialog(this, frmmes);
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmJoinTable:::::::::::::::::btnJoin_Click::::::::::::::::;;" + ex.Message);
            }
        }
Beispiel #13
0
 private void btnEatIn_Click(object sender, EventArgs e)
 {
     try
     {
         Button EatIn        = (Button)sender;
         var    menuid       = Convert.ToInt32(EatIn.Tag);
         var    departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
         var    shiftid      = UserLoginModel.ShiffID;
         var    result       = PermissionService.GetPermissionByDepartment(departmentid, menuid);
         //frmFloor frm = new frmFloor();
         //frm.Show();
         if (result > 0)
         {
             if (shiftid > 0)
             {
                 frmFloor frmfloor = new frmFloor();
                 if (Class.CheckFormShowing.FromShowing("frmFloor"))
                 {
                     Application.OpenForms["frmFloor"].Show();
                     Application.OpenForms["frmFloor"].TopLevel = true;
                 }
                 else
                 {
                     frmfloor.Show();
                 }
             }
             else
             {
                 frmAgainShift frm = new frmAgainShift();
                 if (frmOpacity.ShowDialog(this, frm) == System.Windows.Forms.DialogResult.OK)
                 {
                     this.picWarning.Show();
                     this.lbWarning.Show();
                     frmFloor frm1 = new frmFloor();
                     frm1.Show();
                 }
             }
         }
         else
         {
             frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
             frmOpacity.ShowDialog(this, frm);
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("frmMmain:::::::::::::::::::::::btnEatIn_Click:::::::::::::::::" + ex.Message);
     }
 }
Beispiel #14
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            userid = UserLoginModel.UserLoginInfo.StaffID;
            var result = DatabaseSettingService.BackupDatabaseSetting(userid);
            var text   = "Backup database fail.";

            if (result == 1)
            {
                addTodayList("History", 1);
                text = "Backup database successful.";
            }
            frmMessager frm = new frmMessager("Messenger", text);

            frmOpacity.ShowDialog(this, frm);
        }
Beispiel #15
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (CheckTotal() == 1)
     {
         OrderMain.ListPayment       = lstPayment;
         OrderMain.ListInvoiceByCard = lstInvoiceByCard;
         this.Close();
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         frmMessager frm = new frmMessager("Payment", "Insufficient Amount");
         frmOpacity.ShowDialog(this, frm);
     }
 }
Beispiel #16
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     if (usermodel.StaffID > 0)
     {
         var passcheck = StaffModel.Decrypt(usermodel.Password);
         var passinput = textBox1.Text;
         SetImgLogin(passinput);
         if (passinput.Count() == 4)
         {
             if (passinput == passcheck)
             {
                 if (CheckCallform == 0)
                 {
                     UserLoginModel.UserLoginInfo = usermodel;
                     frmMain frm = new frmMain();
                     frm.ShowDialog();
                     this.Close();
                 }
                 else
                 {
                     this.DialogResult = System.Windows.Forms.DialogResult.OK;
                     this.Close();
                 }
             }
             else
             {
                 var passshow = textBox1.Text;
                 if (passshow.Count() > 0)
                 {
                     this.lblMessger.Visible = true;
                     //frmMessager frm = new frmMessager("Messenger", "Pin code isn't correct.");
                     //frm.ShowDialog();
                     textBox1.Text = "";
                 }
             }
         }
     }
     else
     {
         var passshow = textBox1.Text;
         if (passshow.Count() > 0)
         {
             frmMessager frm = new frmMessager("Messenger", "Please chose user name");
             frmOpacity.ShowDialog(this, frm);
             textBox1.Text = "";
         }
     }
 }
Beispiel #17
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            modelShift.UpdateBy   = userid;
            modelShift.UpdateDate = DateTime.Now;
            modelShift.EndShift   = DateTime.Now;

            var cashEnd = this.txtCashEnd.Text.Replace("$", "");

            modelShift.CashEnd = double.Parse(cashEnd);

            MoneyFortmat Fomat = new MoneyFortmat(1);

            modelShift.CashEnd = Fomat.getFortMat(modelShift.CashEnd ?? 0);

            var safeDrop = this.txtSafeDrop.Text.Replace("$", "");

            modelShift.SafeDrop = double.Parse(safeDrop);
            modelShift.SafeDrop = Fomat.getFortMat(modelShift.SafeDrop ?? 0);

            if (modelShift.CashEnd < modelShift.CashStart)
            {
                frmMessager frm = new frmMessager("Messenger", "Cash end isn't less than cash start. ");
                frmOpacity.ShowDialog(this, frm);
            }
            else
            {
                var result    = ShiftService.UpdateDataShiftHistory(modelShift);
                var messenger = "Save data end shift fail.";
                if (result > 0)
                {
                    AddDataPrinter();
                    GetListPrinter();
                    foreach (PrinterModel item in PrintData)
                    {
                        Header = item.Header;
                        posPrinter.SetPrinterName(item.PrinterName);
                        posPrinter.printDocument.PrintPage += printDocument_PrintPage;
                        posPrinter.Print();
                    }
                    UserLoginModel.ShiffID = 0;
                    messenger         = "Save data end shift successful.";
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }

                frmMessager frm = new frmMessager("Messenger", messenger);
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #18
0
 private void btnPrintnoBill_Click(object sender, EventArgs e)
 {
     if (CheckTotal() == 1)
     {
         OrderMain.ListPayment       = lstPayment;
         OrderMain.ListInvoiceByCard = lstInvoiceByCard;
         OrderMain.isNoPrintBill     = 1;
         this.Close();
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         frmMessager frm = new frmMessager("Payment", "money not enought");
         frmOpacity.ShowDialog(this, frm);
     }
 }
Beispiel #19
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            //Button button = (Button)sender;
            //BackupDataModel tag = (BackupDataModel)(button.Tag);
            //if (tag != null)
            //{
            frmMessager frm = new frmMessager("Messenger", "Please contact IT support if you want restore database.");

            frmOpacity.ShowDialog(this, frm);
            //}
            //else
            //{
            //    frmMessager frm = new frmMessager("Messenger", "Please select row befor restore data.");
            //    frm.ShowDialog();
            //}
        }
Beispiel #20
0
        private void btnLeft_Click(object sender, EventArgs e)
        {
            try
            {
                if (Seat == 0)
                {
                    frmMessager frm = new frmMessager("Messager", "Input Number Seat");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    OrderSlpitOld = new OrderDateModel();
                    CopyOrder();
                    OrderSlpitNew.addSeat(Seat);
                    foreach (Control ctr in flpOldOrder.Controls)
                    {
                        if (ctr is UCOrder)
                        {
                            UCOrder ucOrder = (UCOrder)ctr;
                            if (ucOrder.BackColor == Color.FromArgb(0, 102, 204))
                            {
                                OrderDetailModel item = (OrderDetailModel)ucOrder.Tag;
                                item.Seat = Seat;

                                if (item.ListOrderDetailModifire.Count > 0)
                                {
                                    for (int i = 0; i < item.ListOrderDetailModifire.Count; i++)
                                    {
                                        item.ListOrderDetailModifire[i].Seat = Seat;
                                    }
                                }
                                OrderSlpitNew.addItemToListAddSeat(item);
                                OrderSlpitOld.addItemToListAddSeat(item);
                                OrderMain.ListOrderDetail.Remove(item);
                            }
                        }
                    }
                    RefeshOrderMain(OrderSlpitOld, flpNewTable);
                    RefeshOrderMain(OrderMain, flpOldOrder);
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmSeat::::::::::::::::::btnLeft_Click::::::::::::::::::::" + ex.Message);
            }
        }
Beispiel #21
0
        private void btnDiscount_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckDiscount() == 1)
                {
                    frmMessager frm = new frmMessager("Discount", "Exitst discount");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    double      totalDiscount;
                    frmDiscount frm = new frmDiscount(Discount);
                    if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Discount = frm.Discount;
                        UCDiscount ucDiscount = new UCDiscount();

                        if (Discount.DiscountType == 1)
                        {
                            ucDiscount.lblMethodType.Text = Discount.DiscountName + "%";
                            totalDiscount            = (OrderMain.SubTotal() * (Convert.ToDouble(Discount.Total / 100.0)) / 100);
                            ucDiscount.lblTotal.Text = "$" + money.Format2(totalDiscount);
                        }
                        else
                        {
                            ucDiscount.lblTotal.Text      = "$" + money.Format2(Discount.Total);
                            totalDiscount                 = Discount.Total;
                            ucDiscount.lblMethodType.Text = Discount.DiscountName;
                        }

                        ucDiscount.Click += ucDiscount_Click;

                        OrderMain.DiscountType = Discount.DiscountType;
                        OrderMain.Discount     = Convert.ToInt32(totalDiscount);
                        flpPaymentType.Controls.Add(ucDiscount);
                        CheckTotal();
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPayment::::::::::::::::::::::::::btnDiscount_Click:::::::::::::" + ex.Message);
            }
        }
Beispiel #22
0
        void ucGroupList_btnSave_Click(object sender, EventArgs e)
        {
            Button        btnSaveGroup = (Button)sender;
            CategoryModel tag          = (CategoryModel)(btnSaveGroup.Tag);

            var ucGroupItem = (UCGroupList)pnDetail.Controls[0];

            if (tag == null)
            {
                tag = new CategoryModel();
            }

            tag.CategoryName     = ucGroupItem.txtGroupNameDesc.Text;
            tag.CategoryNameSort = ucGroupItem.txtGroupNameSort.Text ?? "";
            tag.Color            = ucGroupItem.cbGroupColor.Text ?? "";
            tag.ProductColor     = ucGroupItem.cbProductColor.Text ?? "";
            if (tag.CategoryName != "")
            {
                var result  = CatalogeService.SaveDataCategory(tag);
                var message = "";
                if (result == 1)
                {
                    addGroupList("Group List", 2, this.CurrentPage);
                    message = "Save data group successful.";
                }
                else
                {
                    if (result == -1)
                    {
                        message = "Menu name already exist. Please change group name.";
                    }
                    else
                    {
                        message = "Save data group fail";
                    }
                }
                frmMessager frm = new frmMessager("Messenger", message);
                frmOpacity.ShowDialog(this, frm);
            }
            else
            {
                frmMessager frm = new frmMessager("Messenger", "Group name isn't empty.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #23
0
        private void btnWorkingPeriod_Click(object sender, EventArgs e)
        {
            Button SettingAll   = (Button)sender;
            var    menuid       = Convert.ToInt32(SettingAll.Tag);
            var    departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
            var    result       = PermissionService.GetPermissionByDepartment(departmentid, menuid);

            if (result > 0)
            {
                frmShift frm = new frmShift();
                frm.ShowDialog();
            }
            else
            {
                frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #24
0
        void ucMenuList_btnSave_Click(object sender, EventArgs e)
        {
            Button         catalogue = (Button)sender;
            CatalogueModel tag       = (CatalogueModel)(catalogue.Tag);

            var ucMenu = (UCMenu)pnDetail.Controls[0];

            if (tag == null)
            {
                tag = new CatalogueModel();
            }

            tag.CatalogueName = ucMenu.txtMenuName.Text;
            tag.Color         = ucMenu.cbColor.Text ?? "";

            if (tag.CatalogueName != "")
            {
                var result  = CatalogeService.SavaDataCatalogue(tag);
                var message = "";
                if (result == 1)
                {
                    addMenuList("Menu List", 1);
                    message = "Save data menu successful";
                }
                else
                {
                    if (result == -1)
                    {
                        message = "Menu name already exists. Please change menu name";
                    }
                    else
                    {
                        message = "Save data menu fail";
                    }
                }
                frmMessager frm = new frmMessager("Messager", message);
                frmOpacity.ShowDialog(this, frm);
            }
            else
            {
                frmMessager frm = new frmMessager("Messager", "Menu name isn't empty.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #25
0
 private void btnTakeAway_Click_1(object sender, EventArgs e)
 {
     try
     {
         Button TakeAway     = (Button)sender;
         var    menuid       = Convert.ToInt32(TakeAway.Tag);
         var    departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
         var    shiftid      = UserLoginModel.ShiffID;
         var    result       = PermissionService.GetPermissionByDepartment(departmentid, menuid);
         //frmTakeAway frm = new frmTakeAway();
         //frm.ShowDialog();
         if (result > 0)
         {
             if (shiftid > 0)
             {
                 frmTakeAway frm = new frmTakeAway();
                 this.picWarning.Show();
                 this.lbWarning.Show();
                 frm.ShowDialog();
             }
             else
             {
                 frmAgainShift frm = new frmAgainShift();
                 if (frmOpacity.ShowDialog(this, frm) == System.Windows.Forms.DialogResult.OK)
                 {
                     frmTakeAway frm1 = new frmTakeAway();
                     this.picWarning.Show();
                     this.lbWarning.Show();
                     frm1.ShowDialog();
                 }
             }
         }
         else
         {
             frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
             frmOpacity.ShowDialog(this, frm);
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("frmMain:::::::::::::::::::::::::::::::btnTakeAway_Click_1::::::::::::::::::::::;" + ex.Message);
     }
 }
Beispiel #26
0
        private void ucItemList_btnRemove_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this item ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button          product     = (Button)sender;
                ProductionModel dataProduct = (ProductionModel)(product.Tag);
                var             result      = ProductService.Delete(dataProduct);
                if (result == 1)
                {
                    addItemList("Item List", 3, this.CurrentPage);
                    pnDetail.Controls.Clear();
                    frmMessager frm = new frmMessager("Messenger", "Delete product success");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #27
0
        void btnSaveDepartment_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info role ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button          btnSave = (Button)sender;
                DepartmentModel data    = (DepartmentModel)(btnSave.Tag);

                var viewData = (UCDepartmentListDetail)pDetail.Controls[0];

                if (data == null)
                {
                    data = new DepartmentModel();
                }
                data.DepartmentName = viewData.txtRoleName.Text ?? "";
                if (data.DepartmentName != "")
                {
                    data.UpdateBy = userid;
                    var result    = UserService.SaveDataDeparment(data);
                    var messenger = "Save data role fail.";
                    if (result == 1)
                    {
                        addDepartmentList("User Role", 1);
                        messenger = "Save data Role successful.";
                    }
                    if (result == -1)
                    {
                        messenger = "Role name is exist. Please change role name.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Role name is't empty.Please input data.");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #28
0
        void btnGoToProduct_Click(object sender, EventArgs e)
        {
            Button         btn  = (Button)sender;
            PriceListModel data = (PriceListModel)(btn.Tag);

            if (data.NameDesc == null)
            {
                string      title       = "Waring.";
                string      description = "Please choose product.";
                frmMessager frmMessager = new frmMessager(title, description);
                frmOpacity.ShowDialog(this, frmMessager);
            }
            else
            {
                frmEditProductPriceList frmEditProductPriceList = new frmEditProductPriceList(data);
                if (frmEditProductPriceList.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    addPriceList(5, this.CurrentPage);
                }
            }
        }
Beispiel #29
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            Button            EndShift   = (Button)sender;
            ShiftHistoryModel shiftmodel = (ShiftHistoryModel)(EndShift.Tag);

            if (shiftmodel != null)
            {
                frmEndShift frm = new frmEndShift(shiftmodel);
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    addOnDutyList("On Duty", 1);
                    frm.Close();
                }
            }
            else
            {
                frmMessager frm = new frmMessager("Messenger", "Please select row befor end shift.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #30
0
        private void ucModifier_btnRemove_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this modifier ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button        modifier     = (Button)sender;
                ModifireModel dataModifier = (ModifireModel)(modifier.Tag);
                var           result       = ModifireService.Delete(dataModifier);
                if (result == 1)
                {
                    addModifier("Modifier List", 4, this.CurrentPage);
                    pnDetail.Controls.Clear();
                    frmMessager frm = new frmMessager("Messenger", "Delete modifire success.");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Delete modifire fail.");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #31
0
        void btnDeleteDepartment_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete Role ?");
            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {

                Button btnDelete = (Button)sender;
                DepartmentModel data = (DepartmentModel)(btnDelete.Tag);

                if (data.DepartmentID > 0)
                {
                    var result = UserService.RemoveDepartment(data.DepartmentID, userid);
                    var messenger = "Delete role fail.";
                    if (result == 1)
                    {
                        addDepartmentList("User Role", 1);
                        pDetail.Controls.Clear();
                        messenger = "Delete role successful.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #32
0
        private void btnAddSeat_Click(object sender, EventArgs e)
        {
            try
            {
                frmAddSeat frm = new frmAddSeat();

                if (frmOpacity.ShowDialog(this, frm) == System.Windows.Forms.DialogResult.OK)
                {

                    seat = frm.NumberSeat;
                    if (isChekSeat(seat))
                    {
                        frmMessager frmseat = new frmMessager("AddSeat", "Seat Exists");
                        frmOpacity.ShowDialog(this, frmseat);
                    }
                    else
                    {
                        SeatModel seatAdd = new SeatModel();
                        seatAdd.Seat = seat;

                        lstSeat.Add(seatAdd);
                        OrderMain.ListSeatOfOrder.Add(seatAdd);
                        UCSeat ucSeat = new UCSeat();
                        ucSeat.lblSeat.Text = "Seat " + seat;
                        ucSeat.Click += ucSeat_Click;
                        lblSeat.Text = seat.ToString();
                        flpOrder.Controls.Add(ucSeat);
                        flagUcSeatClick = 0;
                        ClearBackColorSeat();
                    }
                    //OrderMain.addSeat(seat);

                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("btnAddSeat_Click::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }
Beispiel #33
0
        void btnDeleteUser_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete user ?");
            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {

                Button btnDelete = (Button)sender;
                StaffModel data = (StaffModel)(btnDelete.Tag);

                if (data.StaffID > 0)
                {
                    var result = UserService.RemoveStaff(data.StaffID, userid);
                    var messenger = "Delete user fail.";
                    if (result == 1)
                    {
                        addUserList("User List", 2);
                        pDetail.Controls.Clear();
                        messenger = "Delete user successful.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #34
0
        private void btnEatIn_Click(object sender, EventArgs e)
        {
            try
            {
                Button EatIn = (Button)sender;
                var menuid = Convert.ToInt32(EatIn.Tag);
                var departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
                var shiftid = UserLoginModel.ShiffID;
                var result = PermissionService.GetPermissionByDepartment(departmentid, menuid);
                //frmFloor frm = new frmFloor();
                //frm.Show();
                if (result > 0)
                {
                    if (shiftid > 0)
                    {
                        frmFloor frm = new frmFloor();
                        frm.Show();
                    }
                    else
                    {
                        frmAgainShift frm = new frmAgainShift();
                        if (frmOpacity.ShowDialog(this,frm) == System.Windows.Forms.DialogResult.OK)
                        {
                            this.picWarning.Show();
                            this.lbWarning.Show();
                            frmFloor frm1 = new frmFloor();
                            frm1.Show();
                        }
                    }

                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmMmain:::::::::::::::::::::::btnEatIn_Click:::::::::::::::::" + ex.Message);
            }
        }
Beispiel #35
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var data = ShiftService.GetListShiftHistoryByUserid(userid, 0).ToList().FirstOrDefault();

            if (data != null)
            {
                frmMessager frm = new frmMessager("Warning", "Only one working period can be used. To create a new working period, please end the current.");
                frm.ShowDialog();
                //if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                //{
                //    UserLoginModel.ShiffID = data.ShiftHistoryID;
                //}
            }
            else
            {
                frmNewShift frm = new frmNewShift();
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    addOnDutyList("On Duty", 1);
                    frm.Close();
                }
            }
        }
Beispiel #36
0
 private void btnWorkingPeriod_Click(object sender, EventArgs e)
 {
     Button SettingAll = (Button)sender;
     var menuid = Convert.ToInt32(SettingAll.Tag);
     var departmentid = UserLoginModel.UserLoginInfo.DepartmentID;
     var result = PermissionService.GetPermissionByDepartment(departmentid, menuid);
     if (result > 0)
     {
         frmShift frm = new frmShift();
         frm.ShowDialog();
     }
     else
     {
         frmMessager frm = new frmMessager("Messenger", "You can not accept. Please contact admin");
         frmOpacity.ShowDialog(this, frm);
     }
 }
Beispiel #37
0
        private void btnPayMent_Click(object sender, EventArgs e)
        {
            //flags = WinAPI.AW_ACTIVATE | WinAPI.AW_HOR_POSITIVE;
            try
            {
                if (OrderMain.Status == 1)
                    OrderCompleted();
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        frmse.BindOrder(OrderMain);
                        frmPayMent frm = new frmPayMent(OrderMain, 1000, 131073);
                        if (frmOpacity.ShowDialog(this, frm) == System.Windows.Forms.DialogResult.OK)
                        {
                            GetListPaymentPrinter();
                            int result = 0;
                            OrderMain = frm.OrderMain;
                            OrderMain.PrintType = 2;
                            result = InvoiceService.InsertInvoice(OrderMain);

                            if (result == 1)
                            {
                                if (OrderMain.isNoPrintBill == 1)
                                {
                                    if (OrderMain.isTKA == 1)
                                    {
                                        this.Close();
                                        frmTakeAway frmTKA = new frmTakeAway();
                                        frmTKA.Show();

                                    }
                                    else
                                    {
                                        CallBackStatusOrderCancel();
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    PrinterServer printServer = new PrinterServer();
                                    printServer.PrintData(OrderMain, PrintData);
                                    if (OrderMain.isTKA == 1)
                                    {
                                        this.Close();
                                        frmTakeAway frmTKA = new frmTakeAway();
                                        frmTKA.Show();

                                    }
                                    else
                                    {
                                        frmse.fullScreen();
                                        CallBackStatusOrderCancel();
                                        this.Close();
                                    }
                                }
                                foreach(PrinterModel item in PrintData)
                                {
                                    if (item.PrinterType == 4)
                                        Class.RawPrinterHelper.openCashDrawer(item.PrinterName);
                                }

                            }

                        }
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("PayMent", "Order empty");
                        frmOpacity.ShowDialog(this, frm);
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmOrder:::::::::::::::::::::::btnPayMent_Click::::::::::::::::;" + ex.Message);
            }
        }
Beispiel #38
0
        void ucGroupList_btnSave_Click(object sender, EventArgs e)
        {
            Button btnSaveGroup = (Button)sender;
            CategoryModel tag = (CategoryModel)(btnSaveGroup.Tag);

            var ucGroupItem = (UCGroupList)pnDetail.Controls[0];

            if (tag == null)
            {
                tag = new CategoryModel();
            }

            tag.CategoryName = ucGroupItem.txtGroupNameDesc.Text;
            tag.CategoryNameSort = ucGroupItem.txtGroupNameSort.Text ?? "";
            tag.Color = ucGroupItem.cbGroupColor.Text ?? "";
            tag.ProductColor = ucGroupItem.cbProductColor.Text ?? "";
            if (tag.CategoryName != "")
            {
                var result = CatalogeService.SaveDataCategory(tag);
                var message = "";
                if (result == 1)
                {

                    addGroupList("Group List", 2, this.CurrentPage);
                    message = "Save data group successful.";
                }
                else
                {
                    if (result == -1)
                    {
                        message = "Menu name already exist. Please change group name.";
                    }
                    else
                    {
                        message = "Save data group fail";
                    }

                }
                frmMessager frm = new frmMessager("Messenger", message);
                frmOpacity.ShowDialog(this, frm);
            }
            else
            {
                frmMessager frm = new frmMessager("Messenger", "Group name isn't empty.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #39
0
 private void ucItemList_btnRemove_Click(object sender, EventArgs e)
 {
     frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this item ?");
     frmcon.ShowDialog();
     if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         Button product = (Button)sender;
         ProductionModel dataProduct = (ProductionModel)(product.Tag);
         var result = ProductService.Delete(dataProduct);
         if (result == 1)
         {
             addItemList("Item List", 3, this.CurrentPage);
             pnDetail.Controls.Clear();
             frmMessager frm = new frmMessager("Messenger", "Delete product success");
             frmOpacity.ShowDialog(this, frm);
         }
     }
 }
Beispiel #40
0
 void ucGroupList_btnRemove_Click(object sender, EventArgs e)
 {
     frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this group ?");
     frmcon.ShowDialog();
     if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         Button btnRemoveGroup = (Button)sender;
         CategoryModel tag = (CategoryModel)(btnRemoveGroup.Tag);
         if (tag.CategoryID > 0)
         {
             var result = CatalogeService.RemoveCategory(tag.CategoryID, 0);
             var messenge = "";
             if (result == 1)
             {
                 addGroupList("Group List", 2, this.CurrentPage);
                 pnDetail.Controls.Clear();
                 messenge = "Remove group successful.";
             }
             else
             {
                 messenge = "Remove group fail.";
             }
             frmMessager frm = new frmMessager("Messenger", messenge);
             frmOpacity.ShowDialog(this, frm);
         }
     }
 }
Beispiel #41
0
 void btnGoToProduct_Click(object sender, EventArgs e)
 {
     Button btn = (Button)sender;
     PriceListModel data = (PriceListModel)(btn.Tag);
     if (data.NameDesc == null)
     {
         string title = "Waring.";
         string description = "Please choose product.";
         frmMessager frmMessager = new frmMessager(title, description);
         frmOpacity.ShowDialog(this, frmMessager);
     }
     else
     {
         frmEditProductPriceList frmEditProductPriceList = new frmEditProductPriceList(data);
         if (frmEditProductPriceList.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             addPriceList(5, this.CurrentPage);
         }
     }
 }
Beispiel #42
0
        private void ucModifier_btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Button modifier = (Button)sender;
                ModifireModel dataModifier = (ModifireModel)(modifier.Tag);
                string message_error = "";
                var ucModifier = (UCModifier)pnDetail.Controls[0];
                var modifierName = ucModifier.txtModifierName.Text;
                var modifierColor = ucModifier.cbColor.Text;
                var modifierPrice = Convert.ToDouble(ucModifier.txtModifierPrice.Text) * 1000;

                if (dataModifier == null)
                {
                    dataModifier = new ModifireModel();
                }

                if (modifierName == "")
                {
                    message_error += "Modifire name isn't empty.";
                }
                if (modifierColor == "")
                {
                    message_error += "Modifire Color isn't empty";
                }
                if (modifierPrice.ToString() == "")
                {
                    message_error += "Modifre price isn't empty";
                }
                if (message_error == "")
                {
                    dataModifier.ModifireName = modifierName;
                    dataModifier.Color = modifierColor;
                    dataModifier.CurrentPrice = (modifierPrice);
                    var result = ModifireService.Created(dataModifier);
                    var message = "";
                    if (result == 1)
                    {
                        addModifier("Modifier List", 4, this.CurrentPage);
                        pnDetail.Controls.Clear();
                        message = "Save modifier Successful";
                    }
                    else
                    {
                        if (result == -1)
                        {
                            message = "Modifier name already exist. Please change modifire name.";
                        }
                        else
                        {
                            message = "Save modifier fail";
                        }
                    }
                    frmMessager frm = new frmMessager("Messenger", message);
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", message_error);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
            catch ( Exception ex)
            {
                SystemLog.LogPOS.WriteLog("frmMenuSetting::::::::::::::::::::::ucModifier_btnSave_Click::::::::::::::::"+ex.Message);
            }
        }
Beispiel #43
0
 private void btnVoidAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (OrderMain.Status == 1)
             OrderCompleted();
         else
         {
             if (OrderMain.IsLoadFromData)
             {
                 frmMessager frm = new frmMessager("Meesager", "Can not delete Order");
                 frmOpacity.ShowDialog(this, frm);
             }
             else
             {
                 flpOrder.Controls.Clear();
                 OrderMain.ListOrderDetail.Clear();
             }
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("btnVoidAll_Click::::::::::::::::::::::::::::::::::::::::::::" + ex.Message);
     }
 }
Beispiel #44
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     userid = UserLoginModel.UserLoginInfo.StaffID;
     var result= DatabaseSettingService.BackupDatabaseSetting(userid);
     var text = "Backup database fail.";
     if (result == 1)
     {
         addTodayList("History", 1);
         text = "Backup database successful.";
     }
     frmMessager frm = new frmMessager("Messenger", text);
     frmOpacity.ShowDialog(this, frm);
 }
Beispiel #45
0
        private void frmEndShift_Load(object sender, EventArgs e)
        {
            userid = UserLoginModel.UserLoginInfo.StaffID;

            var modelShift = ShiftService.GetListShiftHistoryByUserid(userid, 0).FirstOrDefault();

            if (userid == 0)
            {
                Form1 frm = new Form1();
                this.Close();
                frm.ShowDialog();
            }
            else
            {
                if (modelShift != null)
                {
                    MoneyFortmat Fomat = new MoneyFortmat(1);
                    shiftid = modelShift.ShiftHistoryID;

                    this.txtShiftName.Text = modelShift.ShiftName ?? "";
                    this.txtStaffName.Text = modelShift.UserName ?? "";
                    this.txtStartTime.Text = (modelShift.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture);
                    this.txtCashStart.Text = Fomat.getValue(modelShift.CashStart ?? 0).ToString("C");

                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Please create new shift. ");
                    this.Close();
                    frm.ShowDialog();
                }

            }
        }
Beispiel #46
0
        void btnSaveUser_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info user ?");
            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {

                Button btnSave = (Button)sender;
                StaffModel data = (StaffModel)(btnSave.Tag);

                var viewData = (UCUserListDetail)pDetail.Controls[0];

                if (data == null)
                {
                    data = new StaffModel();
                }
                data.Fname = viewData.txtFname.Text ?? "";
                data.Lname = viewData.txtLname.Text ?? "";
                data.UserName = viewData.txtUserName.Text ?? "";
                data.Password = viewData.txtPinCode.Text ?? "";

                var cbDepartment = (KeyValueModel)viewData.cbRole.SelectedItem;
                if (cbDepartment != null)
                {
                    data.DepartmentID = cbDepartment.Key;
                }
                var messenger = "";
                if (data.Fname == "")
                    messenger = messenger + "First Name isn't empty. ";
                if (data.Lname == "")
                    messenger = messenger + "Last Name isn't empty. ";
                if (data.UserName == "")
                    messenger = messenger + "User Name isn't empty. ";
                if (data.Password == "")
                    messenger = messenger + "Pin Code isn't empty. ";
                if (data.DepartmentID == 0)
                    messenger = messenger + "Please select role. ";
                if (messenger == "")
                {
                    data.UpdateBy = userid;
                    var result = UserService.SaveDataStaff(data);
                    messenger = "Save data role fail.";
                    if (result == 1)
                    {
                        addUserList("User List", 2);
                        messenger = "Save data info user successful.";
                    }
                    if (result == -1)
                    {
                        messenger = "User name is exist. Please change user name.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", messenger + "Please input data.");
                    frmOpacity.ShowDialog(this, frm);
                }

            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want edit info price of product ?");
            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button btn = (Button)sender;
                PriceListModel dataPriceList = (PriceListModel)(btn.Tag);
                var txtPrice = txtProductPrice.Text;
                var txtName = txtProductName.Text;
                var comboColor = cbColor.Text;
                string message_error = "";

                if (txtPrice == "")
                {
                    message_error = "Price is not empty";
                }
                if (txtName == "")
                {
                    message_error = "Name is not empty";
                }

                if (message_error == "")
                {
                    dataPriceList.CurrentPrice = Convert.ToDouble(txtPrice)*1000;
                    dataPriceList.NameDesc = txtName;
                    if(comboColor == ""){
                        dataPriceList.Color = dataPriceList.Color;
                    } else {
                        dataPriceList.Color = comboColor;
                    }
                    var result = 0;
                    if (dataPriceList.Type == "MODIFIRE")
                    {
                        ModifireModel modifire = new ModifireModel();
                        modifire.ModifireID = dataPriceList.ID;
                        modifire.CurrentPrice = dataPriceList.CurrentPrice;
                        modifire.ModifireName = dataPriceList.NameDesc;
                        modifire.Color = dataPriceList.Color;
                        result = ModifireService.Created(modifire);
                    } else {
                        ProductionModel product = new ProductionModel();
                        product.ProductID = dataPriceList.ID;
                        product.CurrentPrice = dataPriceList.CurrentPrice;
                        product.ProductNameDesc = dataPriceList.NameDesc;
                        product.ProductNameSort = dataPriceList.NameSort;
                        product.Color = dataPriceList.Color;
                        result = ProductService.Created(product);
                    }
                    if (result == 1)
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        frmMessager frmMessager = new frmMessager("Edit Product Price", "Error");
                        frmOpacity.ShowDialog(this, frmMessager);
                        this.Hide();
                    }
                }
                else
                {
                    frmMessager frmMessager = new frmMessager("Edit Product Price", message_error);
                    frmOpacity.ShowDialog(this, frmMessager);
                }
            }
        }
Beispiel #48
0
 private void OrderCompleted()
 {
     frmMessager frm = new frmMessager("Order", "Order Completed");
     frmOpacity.ShowDialog(this, frm);
 }
Beispiel #49
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int result = 0;
            try
            {
                if (flpNewTable.Controls.Count > 0)
                {
                    if (OrderSlpitNew.FloorID == "#" ||Convert.ToInt32(OrderSlpitNew.FloorID)>40)
                    {
                        frmMessager frm = new frmMessager("Messager", "TableNo is unavailable");
                        frmOpacity.ShowDialog(this, frm);
                    }
                    else
                    {
                        GetListPrinter();
                        OrderMain.Seat = 0;
                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            OrderMain.ListOrderDetail[i].Seat = 0;
                        }
                        OrderDateModel OrderTemp = OrderService.GetOrderByTKA(lblNewTable.Text, "");
                        if (OrderTemp.ListOrderDetail.Count > 0)
                        {
                            foreach (OrderDetailModel item in OrderSlpitNew.ListOrderDetail)
                            {
                                item.OrderID = OrderTemp.OrderID;
                                OrderTemp.ListOrderDetail.Add(item);
                            }
                            result = result + OrderService.InsertOrder(OrderTemp);
                        }
                        else
                        {
                            result = result + OrderService.InsertOrder(OrderSlpitNew);
                        }

                        if (OrderMain.isTransferTableAll == 1)
                        {
                             result =result+ OrderService.DeleteJoinTableAll(OrderMain);

                        }
                        else
                        {
                            if(OrderMain.ListOrderDetail.Count>0)
                                result=result+ OrderService.InsertOrder(OrderMain);
                            else
                                result = result + OrderService.DeleteTransferTableAll(OrderMain);

                        }
                        if (result >= 2)
                        {
                            var list = ConfigService.GetConfig();
                            foreach (ConfigModel item in list)
                            {
                                cofig.ABN = item.ABN;
                                cofig.Name = item.Name;
                                cofig.Tel = item.Tel;
                                cofig.Web = item.Web;
                                cofig.Logan = item.Logan;
                                cofig.Note = item.Note;
                                cofig.Address = item.Address;
                            }
                            foreach (PrinterModel item in PrintData)
                            {
                                Header = item.Header;
                                posPrinter.SetPrinterName(item.PrinterName);
                                posPrinter.printDocument.PrintPage += printDocument_PrintPage;
                                posPrinter.Print();
                            }
                        }
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    }

                }

            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmTransferTable::::::::::::::::::::::btnOK_Click::::::::::::::::;;" + ex.Message);
            }
        }
Beispiel #50
0
        private void btnPrintBill_Click(object sender, EventArgs e)
        {
            GetListPaymentPrinter();
            if (OrderMain.isPrevOrder == 1)
            {

                OrderMain.PrintType = 2;
                PrinterServer print = new PrinterServer();
                print.PrintData(OrderMain, PrintData);
            }
            else
            {
                if (OrderMain.ListOrderDetail.Count > 0)
                {
                    int result = OrderService.UpdateOrder(OrderMain);
                    if (result == 1)
                    {
                        OrderMain.PrintType = 3;
                        PrinterServer print = new PrinterServer();
                        print.PrintData(OrderMain, PrintData);
                        CallBackStatusOrderCancel();
                        this.Close();
                    }
                }
                else
                {
                    frmMessager frm = new frmMessager("Print Bill", "Order is empty");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #51
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            Button EndShift = (Button)sender;
            ShiftHistoryModel shiftmodel = (ShiftHistoryModel)(EndShift.Tag);

            if (shiftmodel != null)
            {
                frmEndShift frm = new frmEndShift(shiftmodel);
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    addOnDutyList("On Duty", 1);
                    frm.Close();
                }
            }
            else
            {
                frmMessager frm = new frmMessager("Messenger", "Please select row befor end shift.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #52
0
 private void btnReprint_Click(object sender, EventArgs e)
 {
     GetListPrinter();
     if (OrderMain.isPrevOrder == 1)
         OrderCompleted();
     else
     {
         OrderMain.PrintType = 1;
         OrderMain.IsPrePrint = true;
         OrderMain.IsLoadFromData = false;
         if (OrderMain.ListOrderDetail.Count > 0)
         {
             PrinterServer printServer = new PrinterServer();
             printServer.PrintData(OrderMain, PrintData);
         }
         else
         {
             frmMessager frm = new frmMessager("Print Bill", "Order is empty");
             frmOpacity.ShowDialog(this, frm);
         }
     }
 }
Beispiel #53
0
        private void ucItemList_btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Button product = (Button)sender;
                ProductionModel dataProduct = (ProductionModel)(product.Tag);
                string messageError = "";
                var ucItemList = (UCItemList)pnDetail.Controls[0];
                var productNameDesc = ucItemList.txtNameDesc.Text;
                var productNameSort = ucItemList.txtNameSort.Text;
                var productPrice = Convert.ToDouble(ucItemList.txtPrice.Text) * 1000;
                var productColor = ucItemList.cbProductColor.Text;

                if (dataProduct == null)
                {
                    dataProduct = new ProductionModel();
                }
                if (productNameDesc == "")
                {
                    messageError += "Product name desc isn't empty.";
                }
                if (productNameSort == "")
                {
                    messageError += "Product name sort isn't empty.";
                }
                if (productColor == "")
                {
                    messageError += "Product Color isn't empty";
                }
                if (productPrice.ToString() == "")
                {
                    messageError += "Product price isn't empty";
                }
                if (messageError == "")
                {
                    dataProduct.ProductNameDesc = productNameDesc;
                    dataProduct.ProductNameSort = productNameSort;
                    dataProduct.Color = productColor;
                    dataProduct.CurrentPrice = productPrice;
                    var result = ProductService.Created(dataProduct);
                    var message = "";
                    if (result == 1)
                    {
                        addItemList("Item List", 3, this.CurrentPage);
                        pnDetail.Controls.Clear();
                        message = "Save Product Successful.";
                    }
                    else
                    {
                        if (result == -1)
                        {
                            message = "Product name already exist. Please change product name.";
                        }
                        else
                        {
                            message = "Save product fail.";
                        }
                    }
                    frmMessager frm_item = new frmMessager("Messenger", message);
                    frmOpacity.ShowDialog(this, frm_item);
                }
                else
                {
                    frmMessager frm_item = new frmMessager("Messenger", messageError);
                    frmOpacity.ShowDialog(this, frm_item);
                }
            }
            catch (Exception ex)
            {
                SystemLog.LogPOS.WriteLog("frmMenuSetting:::::::::::::::::::::::::::ucItemList_btnSave_Click::::::::::::::::::" + ex.Message);
            }
        }
Beispiel #54
0
        void btnSaveDepartment_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info role ?");
            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button btnSave = (Button)sender;
                DepartmentModel data = (DepartmentModel)(btnSave.Tag);

                var viewData = (UCDepartmentListDetail)pDetail.Controls[0];

                if (data == null)
                {
                    data = new DepartmentModel();
                }
                data.DepartmentName = viewData.txtRoleName.Text ?? "";
                if (data.DepartmentName != "")
                {
                    data.UpdateBy = userid;
                    var result = UserService.SaveDataDeparment(data);
                    var messenger = "Save data role fail.";
                    if (result == 1)
                    {
                        addDepartmentList("User Role", 1);
                        messenger = "Save data Role successful.";
                    }
                    if (result == -1)
                    {
                        messenger = "Role name is exist. Please change role name.";
                    }
                    frmMessager frm = new frmMessager("Messenger", messenger);
                    frmOpacity.ShowDialog(this, frm);

                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Role name is't empty.Please input data.");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Beispiel #55
0
 void ucMenuList_btnRemove_Click(object sender, EventArgs e)
 {
     frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this menu ?");
     frmcon.ShowDialog();
     if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         Button btnRemove = (Button)sender;
         CatalogueModel tag = (CatalogueModel)(btnRemove.Tag);
         if (tag.CatalogueID > 0)
         {
             var result = CatalogeService.RemoveCatalogue(tag.CatalogueID, 0);
             if (result == 1)
             {
                 addMenuList("Menu List", 1);
                 pnDetail.Controls.Clear();
                 frmMessager frm = new frmMessager("Messenger", "Delete menu successful.");
                 frmOpacity.ShowDialog(this, frm);
             }
             else
             {
                 frmMessager frm = new frmMessager("Messenger", "Delete menu fail.");
                 frmOpacity.ShowDialog(this, frm);
             }
         }
     }
 }
Beispiel #56
0
        void ucMenuList_btnSave_Click(object sender, EventArgs e)
        {
            Button catalogue = (Button)sender;
            CatalogueModel tag = (CatalogueModel)(catalogue.Tag);

            var ucMenu = (UCMenu)pnDetail.Controls[0];
            if (tag == null)
            {
                tag = new CatalogueModel();
            }

            tag.CatalogueName = ucMenu.txtMenuName.Text;
            tag.Color = ucMenu.cbColor.Text ?? "";

            if (tag.CatalogueName != "")
            {
                var result = CatalogeService.SavaDataCatalogue(tag);
                var message = "";
                if (result == 1)
                {
                    addMenuList("Menu List", 1);
                    message = "Save data menu successful";
                }
                else
                {
                    if (result == -1)
                    {
                        message = "Menu name already exists. Please change menu name";
                    }
                    else
                    {
                        message = "Save data menu fail";
                    }
                }
                frmMessager frm = new frmMessager("Messager", message);
                frmOpacity.ShowDialog(this, frm);
            }
            else
            {
                frmMessager frm = new frmMessager("Messager","Menu name isn't empty.");
                frmOpacity.ShowDialog(this, frm);
            }
        }
Beispiel #57
0
 private void btnEnd_Click(object sender, EventArgs e)
 {
     //Button button = (Button)sender;
     //BackupDataModel tag = (BackupDataModel)(button.Tag);
     //if (tag != null)
     //{
         frmMessager frm = new frmMessager("Messenger", "Please contact IT support if you want restore database.");
         frmOpacity.ShowDialog(this, frm);
     //}
     //else
     //{
     //    frmMessager frm = new frmMessager("Messenger", "Please select row befor restore data.");
     //    frm.ShowDialog();
     //}
 }
Beispiel #58
0
 private void ucModifier_btnRemove_Click(object sender, EventArgs e)
 {
     frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this modifier ?");
     frmcon.ShowDialog();
     if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         Button modifier = (Button)sender;
         ModifireModel dataModifier = (ModifireModel)(modifier.Tag);
         var result = ModifireService.Delete(dataModifier);
         if (result == 1)
         {
             addModifier("Modifier List", 4, this.CurrentPage);
             pnDetail.Controls.Clear();
             frmMessager frm = new frmMessager("Messenger", "Delete modifire success.");
             frmOpacity.ShowDialog(this, frm);
         }
         else
         {
             frmMessager frm = new frmMessager("Messenger", "Delete modifire fail.");
             frmOpacity.ShowDialog(this, frm);
         }
     }
 }
Beispiel #59
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (usermodel.StaffID > 0)
            {
                var passcheck = StaffModel.Decrypt(usermodel.Password);
                var passinput = textBox1.Text;
                SetImgLogin(passinput);
                if (passinput.Count() == 4)
                {
                    if (passinput == passcheck)
                    {
                        if (CheckCallform == 0)
                        {
                            UserLoginModel.UserLoginInfo = usermodel;
                            frmMain frm = new frmMain();
                            frm.ShowDialog();
                            this.Close();
                        }
                        else
                        {

                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }

                    }
                    else
                    {
                        var passshow = textBox1.Text;
                        if (passshow.Count() > 0)
                        {
                            this.lblMessger.Visible = true;
                            //frmMessager frm = new frmMessager("Messenger", "Pin code isn't correct.");
                            //frm.ShowDialog();
                            textBox1.Text = "";
                        }

                    }
                }

            }
            else
            {
                var passshow = textBox1.Text;
                if (passshow.Count() > 0)
                {
                    frmMessager frm = new frmMessager("Messenger", "Please chose user name");
                    frmOpacity.ShowDialog(this, frm);
                    textBox1.Text = "";
                }

            }
        }
Beispiel #60
0
        private void btnVoid_Click(object sender, EventArgs e)
        {
            bool isStopVoid = false;
            int countChangeStatus = 0;
            try
            {
                if (OrderMain.Status == 1)
                {
                    OrderCompleted();
                }
                else
                {
                    UCOrder ucOrder;
                    UCItemModifierOfMenu ucItemModifireOfMenu;
                    OrderDetailModifireModel modifier = null;
                    OrderDetailModel items = null;
                    UCSeat ucSeat = null;
                    int CountIndexitemOfSeat = 0;
                    for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                    {
                        if (OrderMain.ListOrderDetail[i].ChangeStatus == 0)
                            countChangeStatus++;

                    }
                    if (countChangeStatus == 1)
                        isStopVoid = true;
                    if (!isStopVoid)
                    {
                        if (flagClick == 1)
                        {

                            ucItemModifireOfMenu = (UCItemModifierOfMenu)flpOrder.Controls[indexControl];
                            modifier = (OrderDetailModifireModel)ucItemModifireOfMenu.Tag;
                        }

                        else
                        {
                            if (numSeat > 0)
                            {
                                ucSeat = (UCSeat)flpOrder.Controls[indexOfUcSeat];
                            }
                            else
                            {
                                ucOrder = (UCOrder)flpOrder.Controls[indexControl];
                                items = (OrderDetailModel)ucOrder.Tag;
                            }
                        }
                        if (items != null)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (items.KeyItem == OrderMain.ListOrderDetail[i].KeyItem)
                                {
                                    if (OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count > 0)
                                    {
                                        for (int indexOfModifier = OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; indexOfModifier > 0; indexOfModifier--)
                                        {
                                            flpOrder.Controls.RemoveAt(indexControl + indexOfModifier);
                                        }
                                        OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Clear();
                                    }

                                    //OrderMain.ListOrderDetail.RemoveAt(i);
                                    OrderMain.ListOrderDetail[i].ChangeStatus = 2;
                                }

                            }

                            flpOrder.Controls.RemoveAt(indexControl);

                        }
                        if (modifier != null)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                {
                                    if (modifier.KeyModi == OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j].KeyModi && modifier.ModifireID == OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j].ModifireID)
                                    {
                                        //OrderMain.ListOrderDetail[i].ListOrderDetailModifire.RemoveAt(j);
                                        OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j].ChangeStatus = 2;
                                    }
                                }
                            }
                            flpOrder.Controls.RemoveAt(indexControl);

                        }
                        if (numSeat > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {

                                if (numSeat == OrderMain.ListOrderDetail[i].Seat && OrderMain.ListOrderDetail[i].ChangeStatus != 2)
                                {
                                    CountIndexitemOfSeat++;
                                    OrderMain.ListOrderDetail[i].ChangeStatus = 2;
                                }
                            }
                            for (int remove = 0; remove < OrderMain.ListSeatOfOrder.Count; remove++)
                            {
                                if (OrderMain.ListSeatOfOrder[remove].Seat == numSeat)
                                {
                                    OrderMain.ListSeatOfOrder[remove].ChangeStatus = 2;
                                }
                            }
                            for (int count = CountIndexitemOfSeat + indexOfUcSeat; count > indexOfUcSeat; count--)
                            {
                                flpOrder.Controls.RemoveAt(count);
                            }

                            flpOrder.Controls.RemoveAt(indexOfUcSeat);
                            numSeat = 0;
                        }
                        else
                        {
                            //flpOrder.Controls.RemoveAt(indexControl);
                            flagClick = 0;
                        }
                        lblSubtotal.Text = "$" + money.Format2(OrderMain.SubTotalVoid());
                        if (OrderMain.IsLoadFromData)
                            OrderService.VoidItemHistory(OrderMain);
                    }
                    else
                    {

                        frmMessager frm = new frmMessager("Void Order", "Can not void");
                        frmOpacity.ShowDialog(this, frm);

                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("btnVoid_Click::::e:::::::::::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }