Beispiel #1
0
        //The index variable of Checker function is similar to GetPermission array.


        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            btnSave.Focus();
            if (!btnSave.IsFocused)
            {
                return;
            }
            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine(BLPermission.SQLDeleteD00T2040(Username));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D00F0040", GetPermission[0]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D00F1040", GetPermission[1]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D05F2010", GetPermission[2]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D91F2140", GetPermission[3]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D07F2010", GetPermission[4]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D91F1240Location", GetPermission[5]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D91F1240UnitID", GetPermission[6]));
            sSQL.AppendLine(BLPermission.SQLInsertD00T2040(Username, "D91F1240Object", GetPermission[7]));
            if (L3SQLServer.ExecuteSQL(sSQL.ToString()))
            {
                Lemon3.Messages.L3Msg.SaveOK();
                return;
            }
            else
            {
                Lemon3.Messages.L3Msg.SaveNotOK();
                btnSave.IsEnabled = true;
            }
        }
Beispiel #2
0
 public static bool EditItem(object InventoryID, object InventoryName, object UnitID, object Price, object Notes, object VAT, object BarCode, object LastModifyUserID, object ImageLocation)
 {
     return(L3SQLServer.ExecuteNoneQuery("sp_EditItem",
                                         CommandType.StoredProcedure,
                                         new string[] { "InventoryID", "InventoryName", "UnitID", "Price", "Notes", "VAT", "BarCode", "LastModifyUserID", "ImageLocation" }
                                         , new object[] { InventoryID, InventoryName, UnitID, Price, Notes, VAT, BarCode, LastModifyUserID, ImageLocation }));
 }
Beispiel #3
0
        private void LoadMaster()
        {
            lbVoucherID.Content = "Mã phiếu: " + VoucherID;
            DataTable dtMaster = L3SQLServer.ReturnDataTable(BLStore.SQLStoreD07P2011(VoucherID, 0));

            if (dtMaster.Rows.Count > 0)
            {
                deVoucherDate.EditValue = dtMaster.Rows[0]["VoucherDate"];
                lkeSupplier.EditValue   = dtMaster.Rows[0]["ObjectID"];
                seTotalMoney.EditValue  = dtMaster.Rows[0]["Amount"];
                if (dtMaster.Rows[0]["IsPayment"].ToString() == "1")
                {
                    chePaid.IsChecked            = true;
                    IsPayment                    = 1;
                    chePaid.IsReadOnly           = true;
                    btnSave.IsEnabled            = false;
                    COL_InventoryID.AllowEditing = DevExpress.Utils.DefaultBoolean.False;
                    COL_Quantity.AllowEditing    = DevExpress.Utils.DefaultBoolean.False;
                    COL_Price.AllowEditing       = DevExpress.Utils.DefaultBoolean.False;
                    COL_VAT.AllowEditing         = DevExpress.Utils.DefaultBoolean.False;
                    COL_Discount.AllowEditing    = DevExpress.Utils.DefaultBoolean.False;
                }
                else
                {
                    chePaid.IsChecked = false;
                }
            }
        }
Beispiel #4
0
        public static DataTable LoadEmployees()
        {
            SqlCommand cmd = new SqlCommand("select ID, Fullname, Username, Role, Email, Phone, LastLogin, FirstDate from D00T0040 left join tblRole on D00T0040.RoleID = tblRole.RoleID");
            DataTable  dt  = L3SQLServer.ReturnDataTable(cmd.CommandText);

            return(dt);
        }
Beispiel #5
0
 public bool EditNew()
 {
     return(L3SQLServer.ExecuteNoneQuery("sp_EditGeneral",
                                         CommandType.StoredProcedure,
                                         new string[] { "ListTypeID", "ListID", "ListName", "Description" }
                                         , new object[] { li.ListTypeID, li.ListID, li.ListName, li.Description }));
 }
Beispiel #6
0
        public static bool AddTable(Table table)
        {
            string sSQL = "INSERT INTO D05T2010 (TableID, TableName, Position, TotalMoney, Status, People, IsPaid)";

            sSQL += "VALUES(" + L3SQLClient.SQLString(table.TableID) + ", N" + L3SQLClient.SQLString(table.TableName) + ", N" + L3SQLClient.SQLString(table.Position) + ", " + L3SQLClient.SQLMoney(0) + ", 0, 0, 0)";
            return(L3SQLServer.ExecuteSQL(sSQL));
        }
Beispiel #7
0
        public static bool AddVoucher(Voucher voucher)
        {
            string sSQL = "INSERT INTO D91T2140 (VoucherID, VoucherDate, UserID, TableID, CountPerson, Amount, Status, AmountCustomerPaid)";

            sSQL += "VALUES(" + L3SQLClient.SQLString(voucher.VoucherID) + ", N" + L3SQLClient.SQLDateTimeSave(voucher.VoucherDate) + ", N" + L3SQLClient.SQLString(voucher.UserID) + ", " + L3SQLClient.SQLString(voucher.TableID) + ", 0, 0, " + voucher.Status + ", 0)";
            return(L3SQLServer.ExecuteSQL(sSQL));
        }
Beispiel #8
0
 public bool EditUser()
 {
     return(L3SQLServer.ExecuteNoneQuery("sp_EditUser",
                                         CommandType.StoredProcedure,
                                         new string[] { "Username", "FullName", "MD5Password", "RoleID", "Email", "Phone" }
                                         , new object[] { user.Username, user.Fullname, user.MD5Password, user.RoleID, user.Email, user.Phone }));
 }
Beispiel #9
0
        private void DoSaveSQL()
        {
            if (AmountPayment > 0)
            {
                Status = 2;
            }
            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine(BLTable.SQLDeleteD91T2141(VoucherID));
            sSQL.AppendLine(BLTable.SQLDeleteD91T2140(VoucherID));
            sSQL.AppendLine(BLTable.SQLInsertD91T2140(VoucherID, TableID, sePeople.EditValue, sePeople.NumberFormat, seTotalMoney.EditValue, seTotalMoney.NumberFormat, Status, AmountPayment));
            sSQL.AppendLine(BLTable.SQLInsertD91T2141s(dtGrid, VoucherID));
            sSQL.AppendLine(BLTable.SQLUpdateStockD91T1040s(dtGrid));
            if (L3SQLServer.ExecuteSQL(sSQL.ToString()))
            {
                if (Status == 1)
                {
                    BLTable.UpdateStatus1(L3SQLClient.SQLMoney(seTotalMoney.EditValue, seTotalMoney.NumberFormat), L3SQLClient.SQLMoney(sePeople.EditValue, sePeople.NumberFormat), TableID);
                }
                else if (Status == 2)
                {
                    BLTable.UpdateStatus2(L3SQLClient.SQLMoney(seTotalMoney.EditValue, seTotalMoney.NumberFormat), L3SQLClient.SQLMoney(sePeople.EditValue, sePeople.NumberFormat), TableID);
                }
                Lemon3.Messages.L3Msg.SaveOK();
                Saved = true;
            }
            else
            {
                Lemon3.Messages.L3Msg.SaveNotOK();
                btnSave.IsEnabled = true;
            }
        }
Beispiel #10
0
        private void lkeRole_Loaded(object sender, RoutedEventArgs e)
        {
            DataTable dt = L3SQLServer.ReturnDataTable("select * FROM tblRole");

            lkeRole.ItemsSource   = dt;
            lkeRole.ValueMember   = "RoleID";
            lkeRole.DisplayMember = "Role";
        }
Beispiel #11
0
 private void L3Window_Loaded(object sender, RoutedEventArgs e)
 {
     li.ListTypeID = ListTypeID;
     if (D91F1240.IsAdd == false)
     {
         DataTable dt = L3SQLServer.ReturnDataTable("select * from D91T1240 WHERE ListTypeID = '" + li.ListTypeID + "' and ListID = '" + D91F1240.ListID + "'");
         txtListID.Text       = dt.Rows[0]["ListID"].ToString();
         txtListID.IsReadOnly = true;
         txtListName.Text     = dt.Rows[0]["ListName"].ToString();
         txtDescription.Text  = dt.Rows[0]["Description"].ToString();
     }
 }
Beispiel #12
0
        public static int[] GetPermissionFromDB(string Username)
        {
            int[]     CheckListNumber = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
            DataTable dt = L3SQLServer.ReturnDataTable("select FormID, UserID, Permission from D00T2040 WHERE UserID = " + L3SQLClient.SQLString(Username));

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    switch (row["FormID"].ToString())
                    {
                    case "D00F0040":
                        CheckListNumber[0] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D00F1040":
                        CheckListNumber[1] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D05F2010":
                        CheckListNumber[2] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D91F2140":
                        CheckListNumber[3] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D07F2010":
                        CheckListNumber[4] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D91F1240Location":
                        CheckListNumber[5] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D91F1240UnitID":
                        CheckListNumber[6] = Convert.ToInt32(row["Permission"]);
                        break;

                    case "D91F1240Object":
                        CheckListNumber[7] = Convert.ToInt32(row["Permission"]);
                        break;
                    }
                }
            }
            return(CheckListNumber);
        }
Beispiel #13
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (chePaid.IsChecked == true)
            {
                IsPayment = 1;
            }
            else
            {
                IsPayment = 0;
            }
            CalTotalMoney();
            btnSave.Focus();
            if (!btnSave.IsFocused)
            {
                return;
            }
            if (!AllowSave())
            {
                return;
            }
            btnSave.IsEnabled = false;
            double        Amount = CalTotalMoney();
            StringBuilder sSQL   = new StringBuilder();

            sSQL.AppendLine(BLStore.SQLDeleteD07T2011(VoucherID));
            sSQL.AppendLine(BLStore.SQLDeleteD07T2010(VoucherID));
            sSQL.AppendLine(BLStore.SQLInsertD07T2011s(VoucherID, dtGrid));
            sSQL.AppendLine(BLStore.SQLInsertD07T2010(VoucherID, lkeSupplier.EditValue.ToString(), Amount, IsPayment));
            if (bAdd)
            {
                sSQL.AppendLine(BLStore.UpdateStockD91T1040(dtGrid));
            }
            if (L3SQLServer.ExecuteSQL(sSQL.ToString()))
            {
                Lemon3.Messages.L3Msg.SaveOK();
                LoadMaster();
                VoucherID = "";
            }
            else
            {
                Lemon3.Messages.L3Msg.SaveNotOK();
                btnSave.IsEnabled = true;
            }
        }
Beispiel #14
0
        private void tsbDelete_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            string        VoucherID = GridStore.GetFocusedRowCellValue(COL_VoucherID).ToString();
            int           i         = GridStore.View.FocusedRowData.RowHandle.Value;
            StringBuilder sSQL      = new StringBuilder();

            sSQL.AppendLine(BLStore.SQLDeleteD07T2011(VoucherID));
            sSQL.AppendLine(BLStore.SQLDeleteD07T2010(VoucherID));
            try
            {
                L3SQLServer.ExecuteSQL(sSQL.ToString());
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi!");
            }
            LoadTDBGrid();
            GridStore.FocusRowHandle(i);
        }
Beispiel #15
0
 private void btnApply_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable dtGrid = new DataTable();
         if (lkeTable.EditValue == null)
         {
             dtGrid = L3SQLServer.ReturnDataTable(SQLStoreD91P2142("", 1));
         }
         else
         {
             dtGrid = L3SQLServer.ReturnDataTable(SQLStoreD91P2142(lkeTable.EditValue.ToString(), 0));
         }
         L3DataSource.LoadDataSource(GridPBL, dtGrid);
     }
     catch (Exception)
     {
         MessageBox.Show("Lỗi!");
     }
 }
Beispiel #16
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     sePhone.InputNumber288("n0", false, false);
     if (D00F0040.IsEdit)
     {
         DataTable dt = L3SQLServer.ReturnDataTable("select FullName, Username, Email, Phone, RoleID, MD5Password from D00T0040 WHERE Username = '******'");
         txtEmail.Text          = dt.Rows[0]["Email"].ToString();
         txtFullname.Text       = dt.Rows[0]["FullName"].ToString();
         txtUsername.IsReadOnly = true;
         txtUsername.Text       = dt.Rows[0]["Username"].ToString();
         try
         {
             sePhone.Value = System.Convert.ToDecimal(dt.Rows[0]["Phone"]);
         }
         catch (Exception)
         {
             sePhone.Value = 0;
         }
         lkeRole.EditValue = dt.Rows[0]["RoleID"];
         user.MD5Password  = dt.Rows[0]["MD5Password"].ToString();
     }
 }
Beispiel #17
0
        public static void DeleteEmployee(string Username)
        {
            SqlCommand cmd = new SqlCommand("DELETE D00T0040 where Username = '******'");

            L3SQLServer.ExecuteSQL(cmd.CommandText);
        }
Beispiel #18
0
 public static DataTable SelectInventoryID(string sInventoryID)
 {
     return(L3SQLServer.ReturnDataTable("select * FROM D91T1040 where IsDelete = 0 and InventoryID = '" + sInventoryID + "'"));
 }
Beispiel #19
0
 public static void DeleteListTypeID(string ListTypeID, string ListID)
 {
     L3SQLServer.ExecuteSQL("DELETE D91T1240 where ListTypeID = '" + ListTypeID + "' and ListID = '" + ListID + "'");
 }
Beispiel #20
0
 public static DataTable LoadListType(string ListTypeID)
 {
     return(L3SQLServer.ReturnDataTable("select * from D91T1240 WHERE ListTypeID = '" + ListTypeID + "'"));
 }
Beispiel #21
0
 static public DataTable ReturnLookupInventory()
 {
     return(L3SQLServer.ReturnDataTable("select InventoryID, InventoryName, UnitID, VAT, Price FROM D91T1040"));
 }
Beispiel #22
0
        public static bool IfUsernameValid(string username)
        {
            SqlCommand cmd2 = new SqlCommand("select Username from D00T0040 Where Username = '******'");

            return(L3SQLServer.ExecuteSQL(cmd2.CommandText));;
        }
Beispiel #23
0
 public static DataTable LoadGridVoucher()
 {
     return(L3SQLServer.ReturnDataTable("select VoucherID, VoucherDate, ObjectID, Amount, IsPayment from D07T2010"));
 }
Beispiel #24
0
 private void LoadTDBGrid()
 {
     dtGrid = L3SQLServer.ReturnDataTable(BLStore.SQLStoreD07P2011(VoucherID, 1));
     L3DataSource.LoadDataSource(GridVoucherInventory, dtGrid, true);
 }
Beispiel #25
0
 public static DataTable LoadInventory(string InventoryID)
 {
     return(L3SQLServer.ReturnDataTable("select InventoryName, UnitID, Price, Notes, VAT, BarCode, ImageLocation from D91T1040 WHERE InventoryID = '" + InventoryID + "'"));
 }
Beispiel #26
0
 public static DataTable LoadUnitID()
 {
     return(L3SQLServer.ReturnDataTable("select ListTypeID, ListID, ListName, Description FROM D91T1240 WHERE ListTypeID = 'UnitID'"));;
 }
Beispiel #27
0
 public static void DeleteInventory(string InventoryID)
 {
     L3SQLServer.ExecuteSQL("DELETE D91T1040 where InventoryID = '" + InventoryID + "'");
 }
Beispiel #28
0
 public static DataTable LoadMaster(string VoucherID)
 {
     return(L3SQLServer.ReturnDataTable("SELECT * FROM D91T2140 WHERE VoucherID = " + VoucherID));
 }
Beispiel #29
0
 public static DataTable LoadItem()
 {
     return(L3SQLServer.ReturnDataTable("select InventoryID, InventoryName, ListName, Price, Notes, VAT, BarCode, InStock from D91T1040 left join D91T1240 on D91T1040.UnitID = D91T1240.ListID"));
 }
Beispiel #30
0
 static public DataTable ReturnObjectIDTable()
 {
     return(L3SQLServer.ReturnDataTable("select * FROM D91T1240 WHERE ListTypeID = 'ObjectID'"));
 }