Exemplo n.º 1
0
        private void DeleteStore()
        {
            string strError = "";

            if (storeIDList.Contains("$"))
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", storeIDList.Split('$').Length.ToString())))
                {
                    strError = busStore.DeleteListStore(storeIDList, storeCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }
            else
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
                {
                    strError = busStore.DeleteStore(storeIDList, storeCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }

            if (strError.Equals(""))
            {
                LoadAllData();
            }
            else
            {
                Commons.ShowMessage(strError, 0);
            }
        }
Exemplo n.º 2
0
 private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (SaveAllPermission(trlPermission.Nodes, trlUser.FocusedNode.Level))
     {
         Commons.ShowMessage((User.UserInfo.LanguageID.Equals("VN")) ? "Cập nhật phân quyền dữ liệu thành công." : "Update permission successfully.", 1);
     }
 }
Exemplo n.º 3
0
    private bool CheckValidate()
    {
        if (txtUsername.Text.Equals(""))
        {
            depError.SetError(txtUsername, Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage));
            txtUsername.Focus();
            return(false);
        }
        if (txtUsername.Text.Contains(" "))
        {
            depError.SetError(txtUsername, Lang.GetMessageByLanguage("000004", Commons.Culture, Commons.ResourceMessage));
            txtUsername.Focus();
            return(false);
        }
        if (txtPassword.Text.Equals(""))
        {
            depError.SetError(txtPassword, Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage));
            txtPassword.Focus();
            return(false);
        }
        if (string.IsNullOrEmpty(gluGroupUser.EditValue + ""))
        {
            depError.SetError(gluGroupUser, Lang.GetMessageByLanguage("000003", Commons.Culture, Commons.ResourceMessage));
            gluGroupUser.ShowPopup();
            return(false);
        }
        if (!txtEmail.Text.Equals("") && !Commons.CheckEmailValid(txtEmail.Text))
        {
            depError.SetError(txtEmail, Lang.GetMessageByLanguage("000013", Commons.Culture, Commons.ResourceMessage));
            txtEmail.Focus();
            return(false);
        }

        return(true);
    }
Exemplo n.º 4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (CheckValidate())
     {
         string strError = "";
         try
         {
             strError = busUser.ChangePassword(txtUsername.Text, User.UserInfo.LanguageID, Encryption.Encrypt(txtNewPassword.Text));
             if (strError.Equals(""))
             {
                 txtOldPassword.EditValue = txtNewPassword.EditValue = txtConfirmPassword.EditValue = null;
                 Commons.ShowMessage((User.UserInfo.LanguageID.Equals("VN")) ? "Đổi mật khẩu thành công." : "Change password successfully.", 1);
                 User.UserInfo = busUser.GetDataByID(txtUsername.Text, txtUsername.Text, User.UserInfo.LanguageID);
                 txtOldPassword.Focus();
                 depError.ClearErrors();
             }
             else
             {
                 Commons.ShowMessage(strError, 0);
                 txtOldPassword.Focus();
             }
         }
         catch (Exception ex)
         {
             Commons.ShowExceptionMessage(ex);
             txtOldPassword.Focus();
         }
     }
 }
Exemplo n.º 5
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         SYS_tblUserDTO item = busUser.GetDataByID(curRow["Username"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_UserDetail(this, item), "Cập Nhật Người Dùng", "Update User", new System.Drawing.Size(455, 460));
         }
     }
 }
Exemplo n.º 6
0
 private void txtEmail_EditValueChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtEmail.Text))
     {
         depError.SetError(txtEmail, !Commons.CheckEmailValid(txtEmail.Text) ? Lang.GetMessageByLanguage("000013", Commons.Culture, Commons.ResourceMessage) : null);
     }
     else
     {
         depError.SetError(txtEmail, null);
     }
 }
Exemplo n.º 7
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblDistrictDTO item = busDistrict.GetDataByID(curRow["DistrictID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_DistrictDetail(this, item), "Cập Nhật Quận Huyện", "Update District", new Size(435, 270));
         }
     }
 }
Exemplo n.º 8
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         SYS_tblGroupUserDTO item = busGroupUser.GetDataByID(curRow["GroupID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_GroupUserDetail(this, item), "Cập Nhật Nhóm Người Dùng", "Update Group User", new Size(450, 290));
         }
     }
 }
Exemplo n.º 9
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblStoreDTO item = busStore.GetDataByID(curRow["StoreID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_StoreDetail(this, item), "Cập Nhật Cửa Hàng", "Update Store", new Size(660, 400));
         }
     }
 }
Exemplo n.º 10
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblProvinceDTO item = busProvince.GetDataByID(curRow["ProvinceID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_ProvinceDetail(this, item), "Cập Nhật Tỉnh Thành", "Update Province", new Size(435, 265));
         }
     }
 }
Exemplo n.º 11
0
        private bool SaveStore(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblStoreDTO item = new PRO_tblStoreDTO
                {
                    Activity        = (isEdit) ? "Update" : "Insert",
                    Username        = User.UserInfo.Username,
                    LanguageID      = User.UserInfo.LanguageID,
                    StoreID         = txtStoreID.Text,
                    StoreCode       = txtStoreCode.Text,
                    ShortCode       = txtShortCode.Text,
                    VNName          = txtVNName.Text,
                    ENName          = txtENName.Text,
                    BuildDate       = dteBuildDate.EditValue,
                    EndDate         = dteEndDate.EditValue,
                    AddressVN       = txtAddressVN.Text,
                    AddressEN       = txtAddressEN.Text,
                    Phone           = txtPhone.Text,
                    Fax             = txtFax.Text,
                    Rank            = speRank.EditValue,
                    TaxCode         = txtTaxCode.Text,
                    Used            = chkUsed.Checked,
                    IsRoot          = chkIsRoot.Checked,
                    Representatives = txtRepresentives.Text,
                    Note            = mmoNote.Text,
                    Photo           = picPhoto.EditValue,
                    ProvinceID      = gluProvince.EditValue + "",
                    DistrictID      = gluDistrict.EditValue + ""
                };
                strError = (isEdit) ? busStore.UpdateStore(item) : busStore.InsertStore(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtStoreCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 12
0
 private void trlUser_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     try
     {
         trlPermission.ClearNodes();
         TreeListNode node = trlUser.FocusedNode;
         LoadPermission(node.GetDisplayText(tlcCode) + "", "", rootNode, node.Level);
     }
     catch (Exception ex)
     {
         Commons.ShowExceptionMessage(ex);
         return;
     }
 }
Exemplo n.º 13
0
    private bool SaveUser(bool isEdit)
    {
        string strError = "";

        try
        {
            SYS_tblUserDTO item = new SYS_tblUserDTO
            {
                UserName             = txtUsername.Text,
                Password             = Encryption.Encrypt(txtPassword.Text),
                GroupID              = gluGroupUser.EditValue + "",
                EmpID                = (chkIsEmployee.Checked) ? gluEmployee.EditValue + "" : "",
                FullName             = txtFullName.Text,
                EffectiveDate        = daeEffectiveDate.DateTime,
                DateChangePass       = null,
                ToDate               = (daeToDate.EditValue == null) ? null : daeToDate.EditValue,
                Locked               = chkLock.Checked,
                LockDate             = (chkLock.Checked) ? daeLockDate.EditValue : null,
                UnlockDate           = (daeUnlockDate.EditValue == null) ? null : daeUnlockDate.EditValue,
                CanNotChangePassword = chkCanNotChangePassword.Checked,
                ChangePassNextTime   = chkChangePassNextTime.Checked,
                PassNeverExpired     = chkPasswordNeverExpired.Checked,
                Email                = txtEmail.Text,
                Note       = mmoNote.Text,
                Activity   = (isEdit) ? "Update" : "Insert",
                Username   = User.UserInfo.Username,
                LanguageID = User.UserInfo.LanguageID
            };
            strError = (isEdit) ? busUser.UpdateUser(item) : busUser.InsertUser(item);
            if (strError != "")
            {
                Commons.ShowMessage(strError, 0);
                txtUsername.Focus();
                return(false);
            }
            else
            {
                parentForm.LoadAllData();
            }
        }
        catch (Exception ex)
        {
            Commons.ShowExceptionMessage(ex);
            txtUsername.Focus();
            return(false);
        }

        return(true);
    }
Exemplo n.º 14
0
 private void GetCurrentRow()
 {
     try
     {
         curRow = (DataRowView)grvStore.GetFocusedRow();
         if (curRow != null)
         {
             Commons.SetDislayStringArray(new DevExpress.XtraBars.BarStaticItem[] { lblCreater, lblCreateTime, lblEditer, lblEditTime }, new string[] { curRow["Creater"].ToString(), curRow["CreateTime"].ToString(), curRow["Editer"].ToString(), curRow["EditTime"].ToString() });
         }
     }
     catch (Exception ex)
     {
         Commons.ShowExceptionMessage(ex);
     }
 }
Exemplo n.º 15
0
        private bool SaveWarehouse(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblWarehouseDTO item = new PRO_tblWarehouseDTO
                {
                    Activity      = (isEdit) ? "Update" : "Insert",
                    Username      = User.UserInfo.Username,
                    LanguageID    = User.UserInfo.LanguageID,
                    WarehouseID   = txtWarehouseID.Text,
                    WarehouseCode = txtWarehouseCode.Text,
                    VNName        = txtVNName.Text,
                    ENName        = txtENName.Text,
                    StoreID       = gluStore.EditValue + "",
                    AddressVN     = txtAddressVN.Text,
                    AddressEN     = txtAddressEN.Text,
                    Phone         = txtPhone.Text,
                    Fax           = txtFax.Text,
                    ProvinceID    = gluProvince.EditValue + "",
                    DistrictID    = gluDistrict.EditValue + "",
                    Rank          = speRank.EditValue,
                    Used          = chkUsed.Checked,
                    Note          = mmoNote.Text
                };
                strError = (isEdit) ? busWarehouse.UpdateWarehouse(item) : busWarehouse.InsertWarehouse(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 16
0
    private bool SaveAllPermission(TreeListNodes parent_node, int type)
    {
        string strError = "";

        try
        {
            SYS_tblPermissionDTO item;
            foreach (TreeListNode node in parent_node)
            {
                item = new SYS_tblPermissionDTO
                {
                    Username    = User.UserInfo.Username,
                    LanguageID  = User.UserInfo.LanguageID,
                    GroupID     = node.GetValue(tlcID) + "",
                    UserName    = node.GetValue(tlcID) + "",
                    FunctionID  = node.GetValue(tlcFunctionID) + "",
                    AllowInsert = Convert.ToBoolean(node.GetValue(tlcAllowInsert)),
                    AllowUpdate = Convert.ToBoolean(node.GetValue(tlcAllowUpdate)),
                    AllowDelete = Convert.ToBoolean(node.GetValue(tlcAllowDelete)),
                    AllowAccess = Convert.ToBoolean(node.GetValue(tlcAllowAccess)),
                    AllowPrint  = Convert.ToBoolean(node.GetValue(tlcAllowPrint)),
                    AllowImport = Convert.ToBoolean(node.GetValue(tlcAllowImport)),
                    AllowExport = Convert.ToBoolean(node.GetValue(tlcAllowExport)),
                    UserLevelID = null,
                    Note        = node.GetValue(tlcNote) + ""
                };
                strError = busPermission.SavePermission(item, type);

                SaveAllPermission(node.Nodes, type);
            }
            if (!strError.Equals(""))
            {
                Commons.ShowMessage(strError, 0);
                return(false);
            }
        }
        catch (Exception ex)
        {
            Commons.ShowExceptionMessage(ex);
            return(false);
        }
        return(true);
    }
Exemplo n.º 17
0
        private bool SaveStall(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblStallDTO item = new PRO_tblStallDTO
                {
                    Activity    = (isEdit) ? "Update" : "Insert",
                    Username    = User.UserInfo.Username,
                    LanguageID  = User.UserInfo.LanguageID,
                    StallID     = txtStallID.Text,
                    StallCode   = txtStallCode.Text,
                    VNName      = txtVNName.Text,
                    ENName      = txtENName.Text,
                    WarehouseID = gluWarehouse.EditValue + "",
                    Rank        = speRank.EditValue,
                    Used        = chkUsed.Checked,
                    Note        = mmoNote.Text
                };
                strError = (isEdit) ? busStall.UpdateStall(item) : busStall.InsertStall(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtStallCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 18
0
        private bool SaveProvince(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblProvinceDTO item = new PRO_tblProvinceDTO
                {
                    Activity     = (isEdit) ? "Update" : "Insert",
                    Username     = User.UserInfo.Username,
                    LanguageID   = User.UserInfo.LanguageID,
                    ProvinceID   = txtProvinceID.Text,
                    ProvinceCode = txtProvinceCode.Text,
                    VNName       = txtVNName.Text,
                    ENName       = txtENName.Text,
                    Rank         = speRank.EditValue,
                    Note         = mmoNote.Text,
                    Used         = chkUsed.Checked
                };
                strError = (isEdit) ? busProvince.UpdateProvince(item) : busProvince.InsertProvince(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtProvinceCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 19
0
    private bool SaveGroupUser(bool isEdit)
    {
        string strError = "";

        try
        {
            SYS_tblGroupUserDTO item = new SYS_tblGroupUserDTO
            {
                GroupID    = txtGroupID.Text,
                GroupCode  = txtGroupCode.Text,
                GroupName  = txtGroupName.Text,
                Note       = mmoNote.Text,
                IsDefault  = chkIsDefault.Checked,
                Active     = chkActive.Checked,
                Activity   = (isEdit) ? "Update" : "Insert",
                Username   = User.UserInfo.Username,
                LanguageID = User.UserInfo.LanguageID
            };
            strError = (isEdit) ? busGroupUser.UpdateGroupUser(item) : busGroupUser.InsertGroupUser(item);
            if (strError != "")
            {
                Commons.ShowMessage(strError, 0);
                txtGroupCode.Focus();
                return(false);
            }
            else
            {
                parentForm.LoadAllData();
            }
        }
        catch (Exception ex)
        {
            Commons.ShowExceptionMessage(ex);
            txtGroupCode.Focus();
            return(false);
        }
        return(true);
    }
Exemplo n.º 20
0
    private void LoadPermission(string id, string parent, TreeListNode parentNode, int type)
    {
        try
        {
            TreeListNode childNode;
            trlPermission.BeginUnboundLoad();
            DataTable dt = new DataTable();
            dt = busPermission.GetDataByGroupOrUser(User.UserInfo.Username, User.UserInfo.LanguageID, id, parent, type);
            foreach (DataRow dr in dt.Rows)
            {
                childNode = trlPermission.AppendNode(new object[] { dr["FunctionName"], dr["AllowAll"], dr["AllowInsert"], dr["AllowUpdate"], dr["AllowDelete"], dr["AllowAccess"], dr["AllowPrint"], dr["AllowImport"], dr["AllowExport"], dr["UserLevelID"], dr["Note"], dr["ID"], dr["FunctionID"] }, parentNode);

                LoadPermission(id, dr["FunctionID"] + "", childNode, type);
            }
            trlPermission.EndUnboundLoad();
            trlPermission.ExpandAll();
        }
        catch (Exception ex)
        {
            Commons.ShowExceptionMessage(ex);
            return;
        }
    }
Exemplo n.º 21
0
 private void LoadAllGroupUser()
 {
     trlUser.ClearNodes();
     try
     {
         trlUser.BeginUnboundLoad();
         DataTable groups = new DataTable();
         groups = busGroup.LoadAllData(User.UserInfo.Username, User.UserInfo.LanguageID);
         foreach (DataRow item in groups.Rows)
         {
             groupNode                  = trlUser.AppendNode(new object[] { item["GroupCode"] + " - " + item["GroupName"], item["GroupID"] }, -1);
             groupNode.ImageIndex       = 0;
             groupNode.SelectImageIndex = 0;
             LoadAllUser(groupNode, item["GroupID"] + "");
         }
         trlUser.EndUnboundLoad();
         trlUser.ExpandAll();
     }
     catch (Exception ex)
     {
         Commons.ShowExceptionMessage(ex);
         return;
     }
 }
Exemplo n.º 22
0
    private void LoadAllUser(TreeListNode group_node, string group_id)
    {
        string strFullName = "";

        try
        {
            trlUser.BeginUnboundLoad();
            DataTable users = new DataTable();
            users = busUser.LoadAllData(User.UserInfo.Username, User.UserInfo.LanguageID, group_id);
            foreach (DataRow item in users.Rows)
            {
                strFullName               = (!item["FullName"].Equals("")) ? " - " + item["FullName"] : "";
                userNode                  = trlUser.AppendNode(new object[] { item["Username"] + strFullName, item["Username"] }, group_node);
                userNode.ImageIndex       = 1;
                userNode.SelectImageIndex = 1;
            }
            trlUser.EndUnboundLoad();
        }
        catch (Exception ex)
        {
            Commons.ShowExceptionMessage(ex);
            return;
        }
    }
Exemplo n.º 23
0
 private void btnExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.QuickExportData(gridStore, grvStore);
 }
Exemplo n.º 24
0
 private void btnImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenImportForm("PRO_Store_FileSelect.xlsx", "PRO_spfrmStoreImport", "PRO", "13");
     LoadAllData();
 }
Exemplo n.º 25
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_StallDetail(this), "Thêm Mới Quầy Bán", "Insert New Stall", new Size(395, 280));
 }
Exemplo n.º 26
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_StoreDetail(this), "Thêm Mới Cửa Hàng", "Insert New Store", new Size(660, 400));
 }
Exemplo n.º 27
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_WarehouseDetail(this), "Thêm Mới Kho Hàng", "Insert New Warehouse", new Size(410, 400));
 }
Exemplo n.º 28
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_GroupUserDetail(this), "Thêm Mới Nhóm Người Dùng", "Insert New Group User", new Size(450, 290));
 }
Exemplo n.º 29
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_DistrictDetail(this), "Thêm Mới Quận Huyện", "Insert New District", new Size(435, 270));
 }
Exemplo n.º 30
0
 private void btnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Commons.OpenInputForm(new uc_UserDetail(this), "Thêm Mới Người Dùng", "Insert New User", new System.Drawing.Size(455, 460));
 }