Ejemplo n.º 1
0
        private void button11_Click(object sender, EventArgs e)
        {
            if (button11.Text.Equals("Lưu lại"))
            {
                if (txtEmpID.Text.Equals(""))
                {
                    Alert.Show("Bạn phải nhập mã đã!", Color.Red);
                    return;
                }
                //cmbCate.SelectedIndex = 0;
                //DataRowView item = (DataRowView)cmbDept.SelectedItem;
                DataTable tmp = get_service.GetEmployeeByID(StaticClass.storeId, txtEmpID.Text);
                if (tmp.Rows.Count > 0)
                {
                    Alert.Show("Mã này đã tồn tại", Color.Red);
                    return;
                }

                int function = 0;
                //MessageBox.Show(tmp.Rows[0]["ItemName"].ToString());
                //DataRowView itemRow = (DataRowView)cmbDept.SelectedItem;
                string deptId = cmbDept.SelectedItem.ToString();
                get_service.CreateEmployee(txtEmpID.Text, txtCus.Text, deptId, txtPass.Text, txtSwipt.Text, txtHour.Text, StaticClass.Form_Color, Employee_Prop.PROMPT, ComboBox2String(cmbThue, Employee_Prop.CFA_Setup_Tax)
                                           , Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbMayIn, Employee_Prop.CFA_Setup_DefPrinter)
                                           , Employee_Prop.PROMPT, ComboBox2String(cmbMH, Employee_Prop.CFA_Inven_Edit), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbKho, Employee_Prop.CFA_Depts_Edit)
                                           , Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbCustEdit, Employee_Prop.CFA_Cust_Edit), ComboBox2String(cmbXemBC, Employee_Prop.CFA_Reports_Display), Employee_Prop.PROMPT
                                           , Employee_Prop.PROMPT, ComboBox2String(cmbKhauTru, Employee_Prop.CFA_Invoice_Discount), ComboBox2String(cmbDoiGia, Employee_Prop.CFA_Invoice_PriceChange), ComboBox2String(cmbXoaMA, Employee_Prop.CFA_Invoice_DeleteItems)
                                           , ComboBox2String(cmbHuyHD, Employee_Prop.CFA_Invoice_Void), Employee_Prop.PROMPT, Employee_Prop.PROMPT, true, Employee_Prop.PROMPT, ComboBox2String(cmbTraLai, Employee_Prop.CFA_Refund_Item), true, true, txtEmpName.Text, Employee_Prop.PROMPT
                                           , Employee_Prop.PROMPT, Employee_Prop.PROMPT, "01", ComboBox2String(cmbXemBK, Employee_Prop.CFA_Other_Tables), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, cbDisable.Checked, cbAdmin.Checked, ComboBox2String(cmb_TamTinh, Employee_Prop.CFA_PRINT_HOLD)
                                           , ComboBox2String(cmbMoKetSat, Employee_Prop.CFA_Open_Cash_Drawer), cbTake.Checked, cbRequire.Checked, Employee_Prop.PROMPT, ComboBox2String(cmbChuyenB, Employee_Prop.CFA_Transfer_Tables), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT
                                           , Employee_Prop.PROMPT, Employee_Prop.PROMPT, txtHo.Text, "", txtTen.Text, txtSSN.Text, txtAdress.Text, "", txtCity.Text, "", "", txtSDT.Text, txtEmail.Text, DateTime.Now, "", Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, ""
                                           , "", Employee_Prop.PROMPT, Employee_Prop.PROMPT, "", Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbChooseCust, Employee_Prop.CFA_AUCTION_SHIP), Employee_Prop.PROMPT, "", StaticClass.storeId, ""
                                           , Employee_Prop.PROMPT, Employee_Prop.PROMPT, 0, 0, ComboBox2String(cmbRecallInvoices, Employee_Prop.CFA_PULLBACK_INVOICE), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT
                                           , Employee_Prop.PROMPT, ComboBox2String(cmbDoiSL, Employee_Prop.CFA_ENDTRANS_CASH), ComboBox2String(cmb_ThanhToan, Employee_Prop.CFA_ENDTRANS_ACCOUNT), Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbTSConfig, Employee_Prop.CFA_TS_CONFIG), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, ComboBox2String(cmbGhiChu, Employee_Prop.CFA_SETUP_RECEIPT_NOTES), Employee_Prop.PROMPT
                                           , Employee_Prop.PROMPT, ComboBox2String(cmbNV, Employee_Prop.CFA_SETUP_EDIT_EMPLOYEES), Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT, Employee_Prop.PROMPT);

                Employees = get_service.GetAllEmployee(StaticClass.storeId);
                limit     = Employees.Rows.Count - 1;
            }
            if (sender.Equals(button4))
            {
                AddState(0);
            }
            else
            {
                AddState(1);
            }
        }
Ejemplo n.º 2
0
 private static bool check(string storeId, string cashierId, string columnName)
 {
     get_GUI getGui = new get_GUI();
     DataTable emp = getGui.GetEmployeeByID(storeId,cashierId);
     Service.ServiceGet service = new ServiceGet();
     if (emp.Rows[0][columnName].ToString() == "Y")
     {
         return true;
     }
     else if (emp.Rows[0][columnName].ToString() == "P")
     {
         FrmAdminPass frm = new FrmAdminPass();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (!service.checkAdminPass(frm.text, storeId))
             {
                 Alert.Show("Password không đúng !",Color.Red);
                 return false;
             }
             else
             {
                 return true;
             }
         }
         else
         {
             return false;
         }
     }
     else if (emp.Rows[0][columnName].ToString() == "N")
     {
         Alert.Show("Bạn không có quyền để\n thực hiện chức năng này",Color.Red);
         return false;
     }
     return false;
 }