Exemple #1
0
        private async void btnSave_Click(object sender, EventArgs e)
        {
            if (CheckValidate())
            {
                CommonEngine.ShowWaitForm(this);
                SYS_tblUserDRO result = new SYS_tblUserDRO();
                try
                {
                    result = await SYS_tblUserBUS.ChangeUserPassword(txtUsername.Text, ConfigEngine.Language, EncryptEngine.Encrypt(txtNewPassword.Text), new DTO.Systems.SYS_tblActionLogDTO
                    {
                        Activity       = BaseConstant.COMMAND_INSERT_EN,
                        UserID         = txtUsername.Text,
                        LanguageID     = ConfigEngine.Language,
                        ActionVN       = "Đổi Mật Khẩu",
                        ActionEN       = "Change Password",
                        FunctionID     = "",
                        FunctionNameVN = "Đổi Mật Khẩu",
                        FunctionNameEN = "Change Password",
                        DescriptionVN  = string.Format("Tài khoản '{0}' vừa đổi mật khẩu thành công vào lúc {1}.", txtUsername.Text, DateTime.Now),
                        DescriptionEN  = string.Format("Account '{0}' has change password successfully at {1}.", txtUsername.Text, DateTime.Now)
                    });

                    CommonEngine.CloseWaitForm();
                    if (string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.userInfo.Password = EncryptEngine.Encrypt(txtNewPassword.Text);
                        txtOldPassword.EditValue       = txtNewPassword.EditValue = txtConfirmPassword.EditValue = null;
                        depError.ClearErrors();
                        CommonEngine.ShowMessage(ConfigEngine.Language.Equals("vi") ? "Đổi mật khẩu người dùng thành công." : "Change user password successfully.", MessageType.Success);
                        this.ParentForm.Close();
                    }
                    else
                    {
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtOldPassword.Focus();
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                    txtOldPassword.Focus();
                }
            }
        }
        private async Task <bool> SaveGroupUser(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this.ParentForm);
            try
            {
                SYS_tblGroupUserDRO result = await SYS_tblGroupUserBUS.InsertUpdateGroupUser(new SYS_tblGroupUserDTO
                {
                    GroupID    = txtGroupID.Text,
                    GroupCode  = txtGroupCode.Text,
                    VNName     = txtVNName.Text,
                    ENName     = txtENName.Text,
                    Note       = mmoNote.Text,
                    IsDefault  = chkIsDefault.Checked,
                    Active     = chkActive.Checked,
                    Activity   = (isEdit) ? BaseConstant.UPDATE_COMMAND : BaseConstant.INSERT_COMMAND,
                    UserID     = CommonEngine.userInfo.UserID,
                    LanguageID = ConfigEngine.Language
                }, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = (isEdit) ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = (isEdit) ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "9",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa thêm mới thành công nhóm người dùng có mã '{1}'.", CommonEngine.userInfo.UserID, txtGroupCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has inserted new group user successfully with group code is '{1}'.", CommonEngine.userInfo.UserID, txtGroupCode.Text)
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtGroupCode.Focus();
                        return(false);
                    }
                    else if (parent_form != null)
                    {
                        await parent_form.GetAllGroupUsers();
                    }
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Exemple #3
0
        private async Task <bool> SaveUser(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this);
            SYS_tblUserDRO result = new SYS_tblUserDRO();

            try
            {
                result = await SYS_tblUserBUS.InsertUpdateUser(new SYS_tblUserDTO
                {
                    Username             = txtUsername.Text,
                    Password             = EncryptEngine.Encrypt(txtPassword.Text.Trim()),
                    GroupID              = gluGroupUser.EditValue + "",
                    EmpID                = chkIsEmployee.Checked ? gluEmployee.EditValue + "" : "",
                    FullName             = txtFullName.Text,
                    EffectiveDate        = dteEffectiveDate.DateTime,
                    ToDate               = dteToDate.EditValue == null ? (DateTime?)null : dteToDate.DateTime,
                    Locked               = chkLocked.Checked,
                    LockDate             = (chkLocked.Checked && dteLockDate.EditValue != null) ? dteLockDate.DateTime : (DateTime?)null,
                    UnlockDate           = (chkLocked.Checked && dteUnlockDate.EditValue != null) ? dteUnlockDate.DateTime : (DateTime?)null,
                    CanNotChangePassword = chkCanNotChangePassword.Checked,
                    ChangePassNextTime   = chkChangePassNextTime.Checked,
                    PassNeverExpired     = chkPasswordNeverExpired.Checked,
                    Email                = txtEmail.Text,
                    Note       = mmoNote.Text,
                    Activity   = (isEdit) ? BaseConstant.UPDATE_COMMAND : BaseConstant.INSERT_COMMAND,
                    UserID     = CommonEngine.userInfo.UserID,
                    LanguageID = ConfigEngine.Language
                }, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = txtUsername.Text,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_UPDATE_EN,
                    ActionVN      = BaseConstant.COMMAND_UPDATE_VI,
                    FunctionID    = "10",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công người dùng có tên tài khoản '{1}'.", CommonEngine.userInfo.UserID, txtUsername.Text.Trim()),
                    DescriptionEN = string.Format("Account '{0}' has updated user successfully with username is '{1}'.", CommonEngine.userInfo.UserID, txtUsername.Text.Trim())
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtUsername.Focus();
                        return(false);
                    }
                    else
                    {
                        parent_form.GetAllUsers();
                    }
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Exemple #4
0
        private async void wzcMain_SelectedPageChanging(object sender, DevExpress.XtraWizard.WizardPageChangingEventArgs e)
        {
            if (e.Page == wwpStepTwo && e.Direction == DevExpress.XtraWizard.Direction.Forward)
            {
                if (!isClickCheckFile)
                {
                    CommonEngine.ShowMessage(ConfigEngine.Language.Equals("vi") ? "Hệ thống sẽ tự động kiểm tra tệp dữ liệu." : "System will auto check valid all data files.", MessageType.Success);
                    e.Cancel = true;

                    CommonEngine.ShowWaitForm(this.ParentForm);
                    isClickCheckFile = await CheckValidTemplate();

                    CommonEngine.CloseWaitForm();
                }
                if (isClickCheckFile && !isGetFileData)
                {
                    var errorFiles = (from file in fileList
                                      where file.IsValid == false
                                      select file).ToList();
                    if (errorFiles != null && errorFiles.Count > 0)
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(ConfigEngine.Language.Equals("vi") ? "Có tập tin bị lỗi, bạn có muốn tiếp tục không?" : "Having corrupted file(s), do you want to continue?"))
                        {
                            CommonEngine.ShowWaitForm(this.ParentForm);
                            await GetDataToImport();

                            CommonEngine.CloseWaitForm();
                            e.Cancel = false;
                        }
                        else
                        {
                            e.Cancel = true;
                            return;
                        }
                    }
                    else
                    {
                        CommonEngine.ShowWaitForm(this.ParentForm);
                        await GetDataToImport();

                        CommonEngine.CloseWaitForm();
                    }

                    wzcMain.SelectedPage = wwpStepTwo;
                }

                wwpStepTwo.AllowNext = isImportAnyFile;
            }
            else if (e.Page == wwpStepOne && e.Direction == DevExpress.XtraWizard.Direction.Backward)
            {
                if (CommonEngine.ShowConfirmMessageAlert(ConfigEngine.Language.Equals("vi") ? "Tất cả dữ liệu sẽ bị mất, bạn có muốn tiếp tục không?" : "All data will be lost, do you want to continue?"))
                {
                    dsMainData.Clear();
                    dsMainData.Tables.Clear();
                    e.Cancel        = false;
                    isImportAnyFile = false;
                    isGetFileData   = false;
                }
                else
                {
                    e.Cancel = true;
                }
            }
            else if (e.Page == wwpStepThree && e.Direction == DevExpress.XtraWizard.Direction.Forward)
            {
                lblResult1.Text = string.Format(ConfigEngine.Language.Equals("vi") ? @"Tổng số tập tin đã chọn: <b>{0}</b> tệp, trong đó có <b><color=RED>{1}</color></b> tệp tin lỗi, <b><color=GREEN>{2}</color></b> tệp tin hợp lệ." : @"Total selected file: <b>{0}</b> file(s), including <b><color=RED>{1}</color></b> invalid file(s), <b><color=GREEN>{2}</color></b> valid file(s).", total_file, invalid_file, correct_file);

                total_row = inserted_row = updated_row = normal_row = invalid_row = 0;
                foreach (DataTable dt in dsMainData.Tables)
                {
                    total_row += dt.Rows.Count;
                    foreach (DataRow dr in dt.Rows)
                    {
                        switch ((dr["Return Message"] + "").Trim())
                        {
                        case "Inserted":
                        case "Đã thêm mới":
                            inserted_row += 1; break;

                        case "Updated":
                        case "Đã cập nhật":
                            updated_row += 1; break;

                        case "": normal_row += 1; break;

                        default: invalid_row += 1; break;
                        }
                    }
                }

                lblResult2.Text  = string.Format(ConfigEngine.Language.Equals("vi") ? @"Tổng số dòng dữ liệu cần nhập: <b>{0}</b> dòng, trong đó:" : @"Total row of data need to import: <b>{0}</b> rows, in which:", total_row);
                lblSummary3.Text = string.Format(ConfigEngine.Language.Equals("vi") ? @"<b><color=GREEN>{0}</color></b> dòng." : @"<b><color=GREEN>{0}</color></b> row(s).", inserted_row);
                lblSummary4.Text = string.Format(ConfigEngine.Language.Equals("vi") ? @"<b><color=BLUE>{0}</color></b> dòng." : @"<b><color=BLUE>{0}</color></b> row(s).", updated_row);
                lblSummary5.Text = string.Format(ConfigEngine.Language.Equals("vi") ? @"<b><color=RED>{0}</color></b> dòng." : @"<b><color=RED>{0}</color></b> row(s).", invalid_row);
                lblSummary6.Text = string.Format(ConfigEngine.Language.Equals("vi") ? @"<b>{0}</b> dòng." : @"<b>{0}</b> row(s).", normal_row);

                wwpStepThree.AllowBack = false;
            }
        }
Exemple #5
0
        private async Task <bool> SaveStore(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this.ParentForm);
            string          file_name = "";
            PRO_tblStoreDRO result    = new PRO_tblStoreDRO();

            try
            {
                if (!string.IsNullOrEmpty(new_file_path))
                {
                    Bitmap image = (Bitmap)Bitmap.FromFile(new_file_path);
                    file_name = await iPOS.BUS.Tools.OBJ_FileBUS.UploadImageFile(image, "Stores");
                }

                result = await PRO_tblStoreBUS.InsertUpdateStore(new PRO_tblStoreDTO
                {
                    StoreID         = isEdit ? txtStoreID.Text : "0",
                    StoreCode       = txtStoreCode.Text,
                    ShortCode       = txtShortCode.Text,
                    VNName          = txtVNName.Text,
                    ENName          = txtENName.Text,
                    BuildDate       = dteBuildDate.EditValue != null ? dteBuildDate.DateTime : (DateTime?)null,
                    EndDate         = dteEndDate.EditValue != null ? dteEndDate.DateTime : (DateTime?)null,
                    AddressEN       = txtAddressEN.Text,
                    AddressVN       = txtAddressVN.Text,
                    ProvinceID      = gluProvince.EditValue + "",
                    DistrictID      = gluDistrict.EditValue + "",
                    Phone           = txtPhone.Text,
                    Fax             = txtFax.Text,
                    TaxCode         = txtTaxCode.Text,
                    Rank            = speRank.EditValue != null ? Convert.ToInt32(speRank.EditValue) : (Int32?)null,
                    Representatives = txtRepresentives.Text,
                    IsRoot          = chkIsRoot.Checked,
                    Used            = chkUsed.Checked,
                    Note            = mmoNote.Text,
                    Photo           = file_name,
                    UserID          = CommonEngine.userInfo.UserID,
                    LanguageID      = ConfigEngine.Language,
                    Activity        = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "13",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công cửa hàng có mã cửa hàng là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtStoreCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} store successfully with store code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtStoreCode.Text)
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtStoreCode.Focus();
                        return(false);
                    }
                    else if (parent_form != null)
                    {
                        parent_form.GetAllStore();
                    }
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
        private async Task <bool> SaveDistrict(bool isEdit)
        {
            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();

            CommonEngine.ShowWaitForm(this);
            try
            {
                result = await iPOS.BUS.Products.PRO_tblDistrictBUS.InsertUpdateDistrict(new PRO_tblDistrictDTO
                {
                    DistrictID   = isEdit ? txtDistrictID.Text : "0",
                    DistrictCode = txtDistrictCode.Text,
                    VNName       = txtVNName.Text,
                    ENName       = txtENName.Text,
                    ProvinceID   = gluProvince.EditValue + "",
                    Rank         = speRank.EditValue != null ? Convert.ToInt32(speRank.Value) : (Int32?)null,
                    Used         = chkUsed.Checked,
                    Note         = mmoNote.Text,
                    UserID       = CommonEngine.userInfo.UserID,
                    Activity     = (isEdit) ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    LanguageID   = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "12",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công quận huyện có mã quận huyện là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtDistrictCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} district successfully with district code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtDistrictCode.Text)
                });

                if (result.ResponseItem.IsError)
                {
                    CommonEngine.CloseWaitForm();
                    CommonEngine.ShowHTTPErrorMessage(result.ResponseItem);
                    txtDistrictCode.Focus();
                    return(false);
                }
                if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    CommonEngine.CloseWaitForm();
                    CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                    txtDistrictCode.Focus();
                    return(false);
                }
                else if (parent_form != null)
                {
                    parent_form.GetAllDistrict();
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Exemple #7
0
        private async Task DeleteStall()
        {
            stall_code_list = "";
            stall_id_list   = "";
            foreach (int index in grvStall.GetSelectedRows())
            {
                stall_code_list = string.Join("$", stall_code_list, grvStall.GetRowCellDisplayText(index, gcolStallCode));
                stall_id_list   = string.Join("$", stall_id_list, grvStall.GetRowCellDisplayText(index, gcolStallID));
            }

            if (stall_code_list.Length > 0)
            {
                stall_code_list = stall_code_list.Substring(1);
            }
            if (stall_id_list.Length > 0)
            {
                stall_id_list = stall_id_list.Substring(1);
            }

            PRO_tblStallDRO result = new PRO_tblStallDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(stall_id_list))
            {
                try
                {
                    if (stall_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", stall_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted stalls successfully with stall codes are '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted stall successfully with stall code is '{1}'.", CommonEngine.userInfo.UserID, stall_code_list)
                            });
                        }
                    }

                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                    {
                        return;
                    }
                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllStall("", "");
                        }
                        else
                        {
                            CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        }
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
                finally
                {
                    CommonEngine.CloseWaitForm();
                }
            }
            else
            {
                CommonEngine.ShowMessage("000027", IMC.Helper.MessageType.Warning, true);
            }
        }
Exemple #8
0
        private async Task <bool> SaveStall(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this);
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                result = await iPOS.BUS.Products.PRO_tblStallBUS.InsertUpdateStall(new PRO_tblStallDTO
                {
                    StallID     = isEdit ? txtStallID.Text : "0",
                    StallCode   = txtStallCode.Text.Trim(),
                    VNName      = txtVNName.Text.Trim(),
                    ENName      = txtENName.Text.Trim(),
                    StoreID     = gluStore.EditValue + "",
                    WarehouseID = gluWarehouse.EditValue + "",
                    Rank        = speRank.EditValue + "",
                    Used        = chkUsed.Checked,
                    Note        = mmoNote.Text.Trim(),
                    UserID      = CommonEngine.userInfo.UserID,
                    Activity    = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    LanguageID  = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "19",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công quầy bán có mã quầy là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtStallCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} stall successfully with stall code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtStallCode.Text)
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtStallCode.Focus();
                        return(false);
                    }
                    else if (parent_form != null)
                    {
                        parent_form.GetAllStall("", "");
                    }
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Exemple #9
0
        private async Task DeleteLevel2()
        {
            level2_code_list = "";
            level2_id_list   = "";

            foreach (int index in grvLevel2.GetSelectedRows())
            {
                if (index >= 0)
                {
                    level2_code_list = string.Join("$", level2_code_list, grvLevel2.GetRowCellDisplayText(index, gcolLevel2Code));
                    level2_id_list   = string.Join("$", level2_id_list, grvLevel2.GetRowCellDisplayText(index, gcolLevel2ID));
                }
            }

            if (level2_code_list.Length > 0)
            {
                level2_code_list = level2_code_list.Substring(1);
            }
            if (level2_id_list.Length > 0)
            {
                level2_id_list = level2_id_list.Substring(1);
            }

            if (!string.IsNullOrEmpty(level2_id_list))
            {
                PRO_tblLevel2DRO result = new PRO_tblLevel2DRO();
                result.ResponseItem.Message = "ready";
                try
                {
                    if (level2_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", level2_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblLevel2BUS.DeleteLevel2(CommonEngine.userInfo.Username, ConfigEngine.Language, level2_id_list, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "21",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những nhóm hàng có mã '{1}'.", CommonEngine.userInfo.UserID, level2_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted product groups successfully with group codes are '{1}'.", CommonEngine.userInfo.UserID, level2_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblLevel2BUS.DeleteLevel2(CommonEngine.userInfo.Username, ConfigEngine.Language, level2_id_list, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "21",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công nhóm hàng có mã '{1}'.", CommonEngine.userInfo.UserID, level2_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted product group successfully with group code is '{1}'.", CommonEngine.userInfo.UserID, level2_code_list)
                            });
                        }
                    }

                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                    {
                        return;
                    }
                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllLevel2();
                        }
                        else
                        {
                            CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        }
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
                finally
                {
                    CommonEngine.CloseWaitForm();
                }
            }
            else
            {
                CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000027", ConfigEngine.Language), MessageType.Error);
            }
        }
Exemple #10
0
        private async Task <bool> SaveLevel1(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this);
            PRO_tblLevel1DRO result = new PRO_tblLevel1DRO();

            try
            {
                result = await PRO_tblLevel1BUS.InsertUpdateLevel1(new PRO_tblLevel1DTO
                {
                    Level1ID        = isEdit ? txtLevel1ID.Text : "0",
                    Level1Code      = txtLevel1Code.Text.Trim(),
                    Level1ShortCode = txtLevel1ShortCode.Text.Trim(),
                    VNName          = txtVNName.Text.Trim(),
                    ENName          = txtENName.Text.Trim(),
                    Rank            = speRank.Text.Trim(),
                    Used            = chkUsed.Checked,
                    Note            = mmoNote.Text.Trim(),
                    Description     = mmoDescription.Text.Trim(),
                    Activity        = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    UserID          = CommonEngine.userInfo.UserID,
                    LanguageID      = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "20",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công ngành hàng có mã ngành hàng là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtLevel1Code.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} product sector successfully with sector code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtLevel1Code.Text)
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtLevel1Code.Focus();
                        return(false);
                    }
                    else if (parent_form != null)
                    {
                        parent_form.GetAllLevel1();
                    }
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Exemple #11
0
        private async Task SavePermission(TreeListNodes nodes, bool is_user)
        {
            List <SYS_tblPermissionDTO> permissionList = new List <SYS_tblPermissionDTO>();

            try
            {
                CommonEngine.ShowWaitForm(this);
                SYS_tblPermissionDRO result = new SYS_tblPermissionDRO();
                permissionList = GetAllPermission(nodes);

                foreach (var item in oldPermissionList)
                {
                    var _item = (from per in permissionList
                                 where per.ID == item.ID && per.FunctionID == item.FunctionID
                                 select per).FirstOrDefault();
                    if (_item != null)
                    {
                        if (_item.AllowInsert == item.AllowInsert && _item.AllowUpdate == item.AllowUpdate &&
                            _item.AllowDelete == item.AllowDelete && _item.AllowPrint == item.AllowPrint &&
                            _item.AllowImport == item.AllowImport && _item.AllowExport == item.AllowExport &&
                            _item.AllowAll == item.AllowAll && _item.AllowAccess == item.AllowAccess &&
                            _item.UserLevelID == item.UserLevelID && _item.Note == item.Note)
                        {
                            permissionList.Remove(_item);
                        }
                    }
                }

                string strMessage = LanguageEngine.GetMessageCaption("000024", ConfigEngine.Language).Replace("$Type$", is_user ? (ConfigEngine.Language.Equals("vi") ? "người dùng" : "user") : (ConfigEngine.Language.Equals("vi") ? "nhóm người dùng" : "group user")).Replace("$Name$", trlUser.FocusedNode.GetDisplayText(tlcName));

                result = await SYS_tblPermissionBUS.UpdatePermission(CommonEngine.userInfo.UserID, ConfigEngine.Language, permissionList, is_user, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_UPDATE_EN,
                    ActionVN      = BaseConstant.COMMAND_UPDATE_VI,
                    FunctionID    = "24",
                    DescriptionVN = strMessage.Replace("$IsError$", "thành công"),
                    DescriptionEN = strMessage.Replace("$IsError$", "successfully")
                });

                CommonEngine.CloseWaitForm();
                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thành công" : "successfully").Trim(), MessageType.Success);
                    }
                    else
                    {
                        CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thất bại" : "failed").Trim(), MessageType.Error);
                    }

                    await LoadPermission(trlUser.FocusedNode.GetDisplayText(tlcCode) + "", rootNode, trlUser.FocusedNode.Level == 0?false : true);
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Exemple #12
0
        private async Task <bool> SaveWarehouse(bool isEdit)
        {
            PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO();

            try
            {
                result = await iPOS.BUS.Products.PRO_tblWarehouseBUS.InsertUpdateStore(new PRO_tblWarehouseDTO
                {
                    WarehouseID   = isEdit ? txtWarehouseID.Text : "0",
                    WarehouseCode = txtWarehouseCode.Text,
                    VNName        = txtVNName.Text.Trim(),
                    ENName        = txtENName.Text.Trim(),
                    StoreID       = gluStore.EditValue + "",
                    AddressVN     = txtAddressVN.Text.Trim(),
                    AddressEN     = txtAddressEN.Text.Trim(),
                    Phone         = txtPhone.Text.Trim(),
                    Fax           = txtFax.Text.Trim(),
                    ProvinceID    = gluProvince.EditValue + "",
                    DistrictID    = gluDistrict.EditValue + "",
                    Rank          = (string.IsNullOrEmpty(speRank.EditValue + "")) ? (Int32?)null : Convert.ToInt32(speRank.EditValue),
                    Used          = chkUsed.Checked,
                    Note          = mmoNote.Text.Trim(),
                    UserID        = CommonEngine.userInfo.UserID,
                    Activity      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    LanguageID    = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "18",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công kho hàng có mã kho hàng là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtWarehouseCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} warehouse successfully with warehouse code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtWarehouseCode.Text)
                });

                if (result.ResponseItem.IsError)
                {
                    CommonEngine.ShowHTTPErrorMessage(result.ResponseItem);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                else
                {
                    parent_form.GetAllWarehouse("");
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }