Beispiel #1
0
        private void LoadAllUser(TreeListNode group_node, string group_id, List <SYS_tblUserDTO> user_list)
        {
            string strFullName = "";

            try
            {
                this.Cursor = Cursors.WaitCursor;
                trlUser.BeginUnboundLoad();
                var users = (from user in user_list
                             where user.GroupID.Equals(group_id)
                             select user).ToList();
                foreach (var user in users)
                {
                    strFullName               = (!string.IsNullOrEmpty(user.FullName)) ? " - " + user.FullName : "";
                    userNode                  = trlUser.AppendNode(new object[] { string.Format(@"{0}{1}", user.Username, strFullName), user.Username }, group_node);
                    userNode.ImageIndex       = 1;
                    userNode.SelectImageIndex = 1;
                }
                trlUser.EndUnboundLoad();
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #2
0
        private async void LoadAllUserLevel()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                SYS_tblUserLevelDRO userLevel = new SYS_tblUserLevelDRO();
                userLevel = await SYS_tblUserLevelBUS.GetAllUserLevel(CommonEngine.userInfo.UserID, ConfigEngine.Language);

                if (!CommonEngine.CheckValidResponseItem(userLevel.ResponseItem))
                {
                    return;
                }
                gluUserLevel.DataSource    = userLevel.UserLevelList;
                gluUserLevel.DisplayMember = "UserLevelName";
                gluUserLevel.ValueMember   = "UserLevelID";
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #3
0
        private async void trlUser_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            try
            {
                trlPermission.ClearNodes();
                TreeListNode node = trlUser.FocusedNode;
                //CommonEngine.ShowWaitForm(this);
                await LoadPermission(node.GetDisplayText(tlcCode) + "", rootNode, node.Level == 0?false : true);

                string result = "", tmpGroup = "", tmpUser = "";
                if (node.Level.Equals(0))
                {
                    tmpGroup = string.Format(@"  {0}: {1}", ConfigEngine.Language.Equals("vi") ? "Nhóm" : "Group", node.GetDisplayText(tlcName));
                    tmpUser  = "";
                }
                else
                {
                    tmpGroup = string.Format(@"  {0}: {1}", ConfigEngine.Language.Equals("vi") ? "Nhóm" : "Group", node.ParentNode.GetDisplayText(tlcName));
                    tmpUser  = string.Format(@"<br>  {0}: {1}", ConfigEngine.Language.Equals("vi") ? "Người dùng" : "User", node.GetDisplayText(tlcName));
                }
                result = string.Format(@"{0}{1}", tmpGroup, tmpUser);
                lblUserInfo.Caption = result;
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return;
            }
            finally
            {
                //CommonEngine.CloseWaitForm();
            }
        }
Beispiel #4
0
        public async void GetAllStall(string store_id, string warehouse_id)
        {
            try
            {
                gridStall.DataBindings.Clear();
                PRO_tblStallDRO stalls = await PRO_tblStallBUS.GetAllStall(CommonEngine.userInfo.UserID, ConfigEngine.Language, false, store_id, warehouse_id, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_LOAD_ALL_DATA_EN,
                    ActionVN      = BaseConstant.COMMAND_LOAD_ALL_DATA_VI,
                    FunctionID    = "19",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu quầy bán.", CommonEngine.userInfo.UserID),
                    DescriptionEN = string.Format("Account '{0}' downloaded successfully data of stalls.", CommonEngine.userInfo.UserID)
                });

                if (!CommonEngine.CheckValidResponseItem(stalls.ResponseItem))
                {
                    return;
                }
                gridStall.DataSource = stalls.StallList != null ? stalls.StallList : null;
                barFooter.Visible    = (stalls.StallList != null && stalls.StallList.Count > 0) ? true : false;
                CommonEngine.LoadUserPermission("19", btnDelete, btnPrint, btnImport, btnExport);
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #5
0
        public async void GetAllUsers()
        {
            try
            {
                gridUser.DataBindings.Clear();
                SYS_tblUserDRO users = new SYS_tblUserDRO();
                users = await SYS_tblUserBUS.GetAllUsers(CommonEngine.userInfo.UserID, CommonEngine.userInfo.LanguageID, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_LOAD_ALL_DATA_EN,
                    ActionVN      = BaseConstant.COMMAND_LOAD_ALL_DATA_VI,
                    FunctionID    = "10",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu người dùng.", CommonEngine.userInfo.UserID),
                    DescriptionEN = string.Format("Account '{0}' downloaded successfully data of users.", CommonEngine.userInfo.UserID)
                });

                if (!CommonEngine.CheckValidResponseItem(users.ResponseItem))
                {
                    return;
                }
                gridUser.DataSource = users.UserList;
                barBottom.Visible   = (users != null && users.UserList.Count > 0) ? true : false;
                CommonEngine.LoadUserPermission("10", btnDelete, btnPrint, btnImport, btnExport);
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #6
0
        public async void GetAllLevel2(string level1_id = "")
        {
            try
            {
                gridLevel2.DataBindings.Clear();
                PRO_tblLevel2DRO level2s = await PRO_tblLevel2BUS.GetAllLevel2(CommonEngine.userInfo.UserID, ConfigEngine.Language, level1_id, false, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_LOAD_ALL_DATA_EN,
                    ActionVN      = BaseConstant.COMMAND_LOAD_ALL_DATA_VI,
                    FunctionID    = "21",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu nhóm hàng.", CommonEngine.userInfo.UserID),
                    DescriptionEN = string.Format("Account '{0}' downloaded successfully data of product group.", CommonEngine.userInfo.UserID)
                });

                if (!CommonEngine.CheckValidResponseItem(level2s.ResponseItem))
                {
                    return;
                }
                gridLevel2.DataSource = level2s.Level2List != null ? level2s.Level2List : null;
                barBottom.Visible     = (level2s.Level2List != null && level2s.Level2List.Count > 0) ? true : false;
                CommonEngine.LoadUserPermission("21", btnDelete, btnPrint, btnImport, btnExport);
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #7
0
        public async void GetAllProvinces()
        {
            try
            {
                gridProvince.DataBindings.Clear();
                PRO_tblProvinceDRO list = await PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, CommonEngine.userInfo.LanguageID, false, new SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = BaseConstant.COMMAND_LOAD_ALL_DATA_EN,
                    ActionVN      = BaseConstant.COMMAND_LOAD_ALL_DATA_VI,
                    FunctionID    = "8",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu tỉnh thành.", CommonEngine.userInfo.UserID),
                    DescriptionEN = string.Format("Account '{0}' downloaded successfully data of provinces.", CommonEngine.userInfo.UserID)
                });

                if (!CommonEngine.CheckValidResponseItem(list.ResponseItem))
                {
                    return;
                }
                gridProvince.DataSource = list.ProvinceList != null ? list.ProvinceList : null;
                barBottom.Visible       = (list.ProvinceList != null && list.ProvinceList.Count > 0) ? true : false;
                CommonEngine.LoadUserPermission("8", btnDelete, btnPrint, btnImport, btnExport);
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #8
0
        private async Task <bool> CheckValidTemplate()
        {
            bool     temp = false;
            FileInfo file;
            var      sheetName = "";

            foreach (var item in fileList)
            {
                try
                {
                    if (!CommonEngine.CheckExistsUnicodeChar(item.FileName))
                    {
                        item.IsValid = false;
                        item.Note    = LanguageEngine.GetMessageCaption("000021", ConfigEngine.Language);
                    }
                    file = new FileInfo(item.FilePath);
                    CommonEngine.SetWaitFormInfo("Đang kiểm tra tập tin " + file.Name, "Checking file " + file.Name, 1);
                    if (file.Exists)
                    {
                        temp = await ReportEngine.CheckValidImportTemplate(CommonEngine.userInfo.UserID, ConfigEngine.Language, strStoreProcedure, file.Name, strModuleID, strFunctionID, file.FullName);

                        if (!temp)
                        {
                            item.IsValid = false;
                            item.Note    = ConfigEngine.Language.Equals("vi") ? "Mẫu không hợp lệ!" : "Invalid template!";
                        }
                        else
                        {
                            item.IsValid   = true;
                            item.Note      = ConfigEngine.Language.Equals("vi") ? "Mẫu hợp lệ!" : "Valid template!";
                            item.SheetName = sheetName;
                            string tmp = item.FileName;
                            tmp            = tmp.Substring(0, tmp.LastIndexOf('.'));
                            tmp            = Regex.Replace(tmp, @"[^a-zA-Z0-9\s-().\[\]]", "");
                            item.TableName = tmp;
                        }
                    }
                    else
                    {
                        item.IsValid = false;
                        item.Note    = ConfigEngine.Language.Equals("vi") ? "Tập tin không tồn tại!" : "File not exists!";
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
            }
            grvSeletedFiles.RefreshData();

            return(true);
        }
Beispiel #9
0
        private async void btnImportSelectedFile_Click(object sender, EventArgs e)
        {
            try
            {
                CommonEngine.ShowWaitForm(this.ParentForm);
                SYS_tblReportCaptionDRO captionList = await iPOS.BUS.Systems.SYS_tblReportCaptionBUS.GetReportCaption(CommonEngine.userInfo.Username, ConfigEngine.Language, strFunctionID, true);

                if (captionList != null && captionList.ReportCaptionList.Count > 0)
                {
                    DataTable dt   = dsMainData.Tables[gluSeletedFiles.EditValue + ""];
                    var       file = (from _file in fileList
                                      where _file.TableName.Equals(gluSeletedFiles.EditValue)
                                      select _file).ToList();

                    if (file != null && file.Count > 0)
                    {
                        string tmp = file[0].CollumArray;
                        if (!string.IsNullOrEmpty(tmp))
                        {
                            SYS_tblImportFileConfigDRO result;
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                result = await iPOS.BUS.Systems.SYS_tblImportFileConfigBUS.ImportDataRow(CommonEngine.userInfo.Username, ConfigEngine.Language, strStoreProcedure, dt.Rows[i], tmp);

                                if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                                {
                                    continue;
                                }
                                dt.Rows[i]["Return Message"] = result.ResponseItem.Message;
                            }
                        }

                        grvMainData.BestFitColumns();
                    }
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            isImportAnyFile      = true;
            wwpStepTwo.AllowNext = isImportAnyFile;
        }
Beispiel #10
0
 private void GetCurrentRow()
 {
     try
     {
         curItem.Clear();
         curItem.Add((PRO_tblStallDTO)grvStall.GetFocusedRow());
         if (curItem != null)
         {
             CommonEngine.ChangeDateTimeActionToCurrentData <PRO_tblStallDTO>(curItem, new DevExpress.XtraBars.BarStaticItem[] { lblCreater, lblCreaterValue, lblCreateTime, lblCreateTimeValue, lblEditer, lblEditerValue, lblEditTime, lblEditTimeValue });
         }
     }
     catch (Exception ex)
     {
         CommonEngine.ShowExceptionMessage(ex);
     }
 }
Beispiel #11
0
        private async Task GetDataToImport()
        {
            try
            {
                total_file   = fileList.Count;
                correct_file = (from item in fileList
                                where item.IsValid == true
                                select item).ToList().Count;
                invalid_file = total_file - correct_file;

                fileList = (from item in fileList
                            where item.IsValid
                            select item).ToList();
                grvSeletedFiles.RefreshData();

                gluSeletedFiles.DataBindings.Clear();
                gluSeletedFiles.Properties.DataSource    = fileList;
                gluSeletedFiles.Properties.ValueMember   = "TableName";
                gluSeletedFiles.Properties.DisplayMember = "FileName";
                if (fileList.Count > 0)
                {
                    gluSeletedFiles.EditValue = fileList[0].TableName;
                }

                DataSet temp         = new DataSet();
                string  column_array = "";
                foreach (var file in fileList)
                {
                    CommonEngine.SetWaitFormInfo("Đang tải tập tin " + file.FileName, "Loading file data " + file.FileName, 1);
                    column_array = "";
                    ReportEngine.GetDataExcel(ref dsMainData, strFunctionID, file.FilePath, file.TableName, file.SheetName, ref column_array);
                    file.CollumArray = column_array.Substring(0, column_array.Length - 1);
                }

                if (dsMainData.Tables.Count > 0)
                {
                    isGetFileData = true;
                    ShowDataTable(dsMainData.Tables[gluSeletedFiles.EditValue + ""]);
                    await ShowRequireColumn();
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #12
0
        private void gridSeletedFiles_DragDrop(object sender, DragEventArgs e)
        {
            Cursor saveCursor = Cursor.Current;

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                FileInfo file;
                Object   data = e.Data.GetData(DataFormats.FileDrop);

                foreach (object obj in (string[])data)
                {
                    file = new FileInfo(obj.ToString());
                    if (file.Exists)
                    {
                        var files = (from item in fileList
                                     where item.FilePath.ToLower().Equals(file.FullName.ToLower())
                                     select item).ToList();
                        if (files != null && files.Count > 0)
                        {
                            continue;
                        }
                        fileList.Add(new SelectedFile
                        {
                            FileName     = file.Name,
                            DateModified = file.LastWriteTime,
                            FileSize     = CommonEngine.StrFormatByteSize(file.Length),
                            FilePath     = file.FullName,
                            IsValid      = false
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                Cursor.Current = saveCursor;
            }
            grvSeletedFiles.RefreshData();
            wwpStepOne.AllowNext = btnCheckValid.Enabled = fileList.Count > 0;
        }
Beispiel #13
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();
                }
            }
        }
Beispiel #14
0
 private void LoadPermission(List <SYS_tblPermissionDTO> permissions, string parent_id, TreeListNode parent_node)
 {
     try
     {
         TreeListNode child_node;
         var          tmp   = permissions;
         var          nodes = (from per in tmp
                               where per.ParentID == parent_id
                               select per).ToList();
         tmp.RemoveAll(per => per.ParentID == parent_id);
         foreach (var node in nodes)
         {
             child_node = trlPermission.AppendNode(new object[] { node.FunctionName, node.AllowAll, node.AllowInsert, node.AllowUpdate, node.AllowDelete, node.AllowAccess, node.AllowPrint, node.AllowImport, node.AllowExport, node.UserLevelID, node.Note, node.ID, node.FunctionID, node.Creater, node.CreateTime, node.Editer, node.EditTime }, parent_node);
             LoadPermission(tmp, node.FunctionID, child_node);
         }
     }
     catch (Exception ex)
     {
         CommonEngine.ShowExceptionMessage(ex);
     }
 }
Beispiel #15
0
        private async void LoadAllGroupUser()
        {
            trlUser.ClearNodes();
            try
            {
                this.Cursor = Cursors.WaitCursor;
                trlUser.BeginUnboundLoad();
                SYS_tblGroupUserDRO groupUser = await SYS_tblGroupUserBUS.GetAllGroupUsers(CommonEngine.userInfo.UserID, ConfigEngine.Language, false, null);

                if (!CommonEngine.CheckValidResponseItem(groupUser.ResponseItem))
                {
                    return;
                }
                groupList = groupUser.GroupUserList;
                SYS_tblUserDRO users = await SYS_tblUserBUS.GetAllUsers(CommonEngine.userInfo.UserID, ConfigEngine.Language, null);

                if (!CommonEngine.CheckValidResponseItem(users.ResponseItem))
                {
                    return;
                }
                userList = users.UserList;
                foreach (var item in groupUser.GroupUserList)
                {
                    groupNode                  = trlUser.AppendNode(new object[] { string.Format(@"{0} - {1}", item.GroupCode, item.GroupName), item.GroupID }, -1);
                    groupNode.ImageIndex       = 0;
                    groupNode.SelectImageIndex = 0;
                    LoadAllUser(groupNode, item.GroupID, users.UserList);
                }
                trlUser.EndUnboundLoad();
                trlUser.ExpandAll();
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #16
0
        private List <SYS_tblPermissionDTO> GetAllPermission(TreeListNodes nodes)
        {
            List <SYS_tblPermissionDTO> permissionList = new List <SYS_tblPermissionDTO>();

            try
            {
                this.Cursor = Cursors.WaitCursor;
                foreach (TreeListNode node in nodes)
                {
                    permissionList.Add(new SYS_tblPermissionDTO
                    {
                        ID          = node.GetValue(tlcID) + "",
                        FunctionID  = node.GetValue(tlcFunctionID) + "",
                        AllowAll    = Convert.ToBoolean(node.GetValue(tlcAllowAll)),
                        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 = node.GetValue(tlcUserLevel) + "",
                        Note        = node.GetValue(tlcNote) + ""
                    });

                    permissionList.AddRange(GetAllPermission(node.Nodes));
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }

            return(permissionList);
        }
Beispiel #17
0
        private async Task LoadPermission(string id, TreeListNode parent_node, bool is_user)
        {
            try
            {
                if (isSecondLoad)
                {
                    CommonEngine.ShowWaitForm(this);
                }
                trlPermission.BeginUnboundLoad();
                trlPermission.ClearNodes();
                SYS_tblPermissionDRO permissionList = await SYS_tblPermissionBUS.GetPermissionList(CommonEngine.userInfo.UserID, ConfigEngine.Language, id, is_user);

                if (CommonEngine.CheckValidResponseItem(permissionList.ResponseItem))
                {
                    oldPermissionList = new List <SYS_tblPermissionDTO>();
                    foreach (var item in permissionList.PermissionList)
                    {
                        oldPermissionList.Add(item);
                    }
                    LoadPermission(permissionList.PermissionList, "", parent_node);
                }
                trlPermission.EndUnboundLoad();
                trlPermission.ExpandAll();
                if (isSecondLoad)
                {
                    CommonEngine.CloseWaitForm();
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }

            if (!isSecondLoad)
            {
                isSecondLoad = true;
            }
        }
Beispiel #18
0
        private async Task LoadGroupUser(SYS_tblUserDTO item)
        {
            try
            {
                SYS_tblGroupUserDRO groupUsers = await iPOS.BUS.Systems.SYS_tblGroupUserBUS.GetAllGroupUsers(CommonEngine.userInfo.Username, ConfigEngine.Language, true, null);

                gluGroupUser.DataBindings.Clear();
                if (!CommonEngine.CheckValidResponseItem(groupUsers.ResponseItem))
                {
                    return;
                }
                else
                {
                    gluGroupUser.Properties.DataSource = groupUsers.GroupUserList;
                }
                gluGroupUser.Properties.DisplayMember = "Note";
                gluGroupUser.Properties.ValueMember   = "GroupID";

                if (item == null && groupUsers.GroupUserList != null)
                {
                    var groupDefault = (from groupUser in groupUsers.GroupUserList
                                        where groupUser.IsDefault.Equals(true)
                                        select groupUser).FirstOrDefault();
                    if (groupUsers.GroupUserList.Count > 0)
                    {
                        gluGroupUser.EditValue = groupDefault.GroupID;
                    }
                }
                else
                {
                    gluGroupUser.EditValue = item.GroupID;
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Beispiel #19
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);
            }
        }
Beispiel #20
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);
        }
Beispiel #21
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);
            }
        }
Beispiel #22
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);
        }
Beispiel #23
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);
        }
Beispiel #24
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);
        }
Beispiel #25
0
        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);
        }
Beispiel #26
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);
            }
        }
Beispiel #27
0
        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);
        }
Beispiel #28
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);
        }