Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
        private async Task LoadProvince()
        {
            gluProvince.DataBindings.Clear();
            PRO_tblProvinceDRO provinces = await iPOS.BUS.Products.PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null);

            if (!CommonEngine.CheckValidResponseItem(provinces.ResponseItem))
            {
                return;
            }
            gluProvince.Properties.DataSource    = provinces.ProvinceList;
            gluProvince.Properties.ValueMember   = "ProvinceID";
            gluProvince.Properties.DisplayMember = "FullProvinceName";
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
        private async void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                PRO_tblStallDRO item = await PRO_tblStallBUS.GetStallItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].StallID);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }

                if (item != null && item.StallItem != null)
                {
                    CommonEngine.OpenInputForm(new uc_StallDetail(this, item.StallItem), new Size(395, 300), true);
                }
            }
        }
Exemplo n.º 9
0
        private async void btnDuplicated_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                PRO_tblLevel2DRO item = await PRO_tblLevel2BUS.GetLevel2ByID(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].Level2ID);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }

                if (item != null && item.Level2Item != null)
                {
                    item.Level2Item.Level2ID = "";
                    CommonEngine.OpenInputForm(new uc_Level2Detail(this, item.Level2Item), new Size(450, 320), false);
                }
            }
        }
Exemplo n.º 10
0
        private async void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                this.Cursor = Cursors.WaitCursor;
                PRO_tblDistrictDRO item = await PRO_tblDistrictBUS.GetDistrictItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].DistrictID);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }
                this.Cursor = Cursors.Default;

                if (item.DistrictItem != null)
                {
                    CommonEngine.OpenInputForm(new uc_DistrictDetail(this, item.DistrictItem), new Size(435, 270), true);
                }
            }
        }
Exemplo n.º 11
0
        private async void btnDuplicated_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                this.Cursor = Cursors.WaitCursor;
                PRO_tblProvinceDRO item = await PRO_tblProvinceBUS.GetProvinceItem(CommonEngine.userInfo.Username, ConfigEngine.Language, curItem[0].ProvinceID);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }
                this.Cursor = Cursors.Default;

                if (item != null && item.ProvinceItem != null)
                {
                    item.ProvinceItem.ProvinceID = "";
                    CommonEngine.OpenInputForm(new uc_ProvinceDetail(this, item.ProvinceItem), new Size(435, 265), true);
                }
            }
        }
Exemplo n.º 12
0
        private async void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                this.Cursor = Cursors.WaitCursor;
                SYS_tblUserDRO item = await SYS_tblUserBUS.GetUserItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].Username);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }

                this.Cursor = Cursors.Default;

                if (item != null && item.UserItem != null)
                {
                    CommonEngine.OpenInputForm(new uc_UserDetail(this, item.UserItem), new Size(455, 460), true);
                }
            }
        }
Exemplo n.º 13
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;
            }
        }
Exemplo n.º 14
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);
            }
        }
Exemplo n.º 15
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;
            }
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
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);
            }
        }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
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);
            }
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
0
        private async Task <bool> SaveProvince(bool isEdit)
        {
            PRO_tblProvinceDRO result = new PRO_tblProvinceDRO();

            CommonEngine.ShowWaitForm(this);
            try
            {
                result = await PRO_tblProvinceBUS.InsertUpdateProvince(new PRO_tblProvinceDTO
                {
                    ProvinceID   = isEdit ? txtProvinceID.Text : "0",
                    ProvinceCode = txtProvinceCode.Text,
                    VNName       = txtVNName.Text,
                    ENName       = txtENName.Text,
                    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    = "8",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công tỉnh thành có mã tỉnh là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtProvinceCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} province successfully with province code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtProvinceCode.Text)
                });

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

            return(true);
        }