示例#1
0
        public async static void LoadUserPermission(string function_id, TextEdit txtID, SimpleButton btnSaveClose, SimpleButton btnSaveInsert, bool isDuplicate = false)
        {
            iPOS.DRO.Systems.SYS_tblPermissionDRO permission = new iPOS.DRO.Systems.SYS_tblPermissionDRO();
            permission = await iPOS.BUS.Systems.SYS_tblPermissionBUS.GetPermissionItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, function_id);

            if (permission.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(permission.ResponseItem);
                btnSaveClose.Enabled = btnSaveInsert.Enabled = false;
                return;
            }
            if (permission.PermissionItem != null)
            {
                if (string.IsNullOrEmpty(txtID.Text) || isDuplicate)
                {
                    btnSaveClose.Enabled = btnSaveInsert.Enabled = permission.PermissionItem.AllowInsert;
                }
                else
                {
                    btnSaveClose.Enabled  = permission.PermissionItem.AllowUpdate;
                    btnSaveInsert.Enabled = permission.PermissionItem.AllowInsert & permission.PermissionItem.AllowUpdate;
                }
            }
            else
            {
                btnSaveClose.Enabled = btnSaveInsert.Enabled = false;
            }
        }
示例#2
0
        private async void btnLogin_Click(object sender, EventArgs e)
        {
            if (await CheckLogin())
            {
                string username = (chkRemember.Checked) ? EncryptEngine.Encrypt(txtUsername.Text.Trim()) : "";
                string password = (chkRemember.Checked) ? EncryptEngine.Encrypt(txtPassword.Text.Trim()) : "";
                IOEngine.Write("Initialize", "Username", username);
                IOEngine.Write("Initialize", "Password", password);

                ResponseItem result = await SYS_tblActionLogBUS.InsertUpdateLog(new SYS_tblActionLogDTO
                {
                    ID             = string.Empty,
                    ActionVN       = "Đăng Nhập",
                    ActionEN       = "Login",
                    ActionTime     = DateTime.Now,
                    FunctionID     = string.Empty,
                    FunctionNameVN = "Đăng Nhập",
                    FunctionNameEN = "Login",
                    DescriptionEN  = string.Format("Account '{0}' has logined to system at {1}.", txtUsername.Text, DateTime.Now),
                    DescriptionVN  = string.Format("Tài khoản '{0}' vừa đăng nhập vào hệ thống vào lúc {1}.", txtUsername.Text, DateTime.Now),
                    FullName       = CommonEngine.userInfo.FullName,
                    Activity       = "Insert",
                    UserID         = CommonEngine.userInfo.UserID,
                    LanguageID     = ConfigEngine.Language
                });

                if (result.IsError)
                {
                    CommonEngine.ShowHTTPErrorMessage(result);
                }
                else
                {
                    if (!string.IsNullOrEmpty(result.Message))
                    {
                        CommonEngine.ShowMessage(result.Message, 0);
                        return;
                    }
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
示例#3
0
        public async static void LoadUserPermission(string function_id, BarLargeButtonItem btnDelete, BarLargeButtonItem btnPrint, BarLargeButtonItem btnImport, BarLargeButtonItem btnExport)
        {
            iPOS.DRO.Systems.SYS_tblPermissionDRO permission = new iPOS.DRO.Systems.SYS_tblPermissionDRO();
            permission = await iPOS.BUS.Systems.SYS_tblPermissionBUS.GetPermissionItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, function_id);

            if (permission.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(permission.ResponseItem);
                btnDelete.Enabled = btnPrint.Enabled = btnImport.Enabled = btnExport.Enabled = false;
                return;
            }
            if (permission.PermissionItem != null)
            {
                btnDelete.Enabled = permission.PermissionItem.AllowDelete;
                btnPrint.Enabled  = permission.PermissionItem.AllowPrint;
                btnImport.Enabled = permission.PermissionItem.AllowImport;
                btnExport.Enabled = permission.PermissionItem.AllowExport;
            }
            else
            {
                btnDelete.Enabled = btnPrint.Enabled = btnImport.Enabled = btnExport.Enabled = false;
            }
        }