Exemplo n.º 1
0
        private void ModifyRoleInfo()
        {
            try
            {
                RoleModel RoleInfo = this.ObjRoleItem as RoleModel;
                string    msg      = string.Format("{0}{1}", Utils.FormatOptLogString("FO1102002"), TxtRoleName.Text);
                //px屏蔽
                //RoleInfo.RoleName = S1102App.EncryptString(TxtRoleName.Text);
                //RoleInfo.IsActive = ChkStartRole.IsChecked == true ? "1" : "0";

                //RoleInfo.EnableTime = DateTime.Parse(DateStart.Value.ToString());
                //RoleInfo.EndTime = DateTime.Parse(DateEnd.Value.ToString());
                //RoleInfo.StrEnableTime = S1102App.EncryptString(RoleInfo.EnableTime.ToString("yyyy/MM/dd HH:mm:ss"));
                //RoleInfo.StrEndTime = S1102App.EncryptString(RoleInfo.EndTime.ToString("yyyy/MM/dd HH:mm:ss"));
                //px-end
                List <string> RoleList = new List <string>();
                RoleList.Add(RoleInfo.RoleID.ToString());
                RoleList.Add(S1102App.EncryptString(TxtRoleName.Text.Trim()));
                RoleList.Add(RoleInfo.ParentRoleID.ToString());
                RoleList.Add(RoleInfo.ModeID.ToString());
                RoleList.Add(RoleInfo.CreatorID.ToString());
                RoleList.Add(RoleInfo.CreatTime.ToString());
                RoleList.Add(ChkStartRole.IsChecked == true ? "1" : "0");
                RoleList.Add(RoleInfo.IsDelete.ToString());
                RoleList.Add(S1102App.EncryptString(DateTime.Parse(DateStart.Text).ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss")));
                RoleList.Add(S1102App.EncryptString(DateTime.Parse(DateEnd.Text).ToString("yyyy/MM/dd HH:mm:ss")));
                RoleList.Add(RoleInfo.OtherStatus.ToString());

                mAsyncResult = false;
                if (PageParent != null)
                {
                    PageParent.SetBusy(true, string.Empty);
                }

                mBackgroundWorker         = new BackgroundWorker();
                mBackgroundWorker.DoWork += (s, de) =>
                {
                    ShowStausMessage(CurrentApp.GetLanguageInfo("1102T00037", "Modifing  The Role Information") + "...");
                    ModifyRoleInfo(RoleList);
                    #region 写操作日志
                    CurrentApp.WriteOperationLog(S1102Consts.OPT_ModifyRole.ToString(), ConstValue.OPT_RESULT_SUCCESS, msg);
                    #endregion
                };
                mBackgroundWorker.RunWorkerCompleted += (s, re) =>
                {
                    mBackgroundWorker.Dispose();

                    if (PageParent != null)
                    {
                        PageParent.SetBusy(false, string.Empty);
                    }
                    ShowStausMessage(CurrentApp.GetLanguageInfo("1102T00038", "Modify The Role Information End"));
                    if (mAsyncResult)
                    {
                        if (PageParent != null)
                        {
                            PageParent.ReloadData();
                            PageParent.ShowObjectDetail();
                        }

                        var parent = Parent as PopupPanel;
                        if (parent != null)
                        {
                            parent.IsOpen = false;
                        }
                    }
                };
                mBackgroundWorker.RunWorkerAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        private void AddRoleInfo()
        {
            try
            {
                RoleInfo = new RoleModel();

                RoleInfo.ParentRoleID = 0;
                RoleInfo.ModeID       = 0;
                string msg = string.Format("{0}{1}", Utils.FormatOptLogString("FO1102001"), TxtRoleName.Text);
                if (string.IsNullOrWhiteSpace(TxtRoleName.Text))
                {
                    CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1102T00034", "Role Information Is Null"));
                    return;
                }
                RoleInfo.RoleName    = S1102App.EncryptString(TxtRoleName.Text.Trim());
                RoleInfo.IsActive    = ChkStartRole.IsChecked == true ? "1" : "0";
                RoleInfo.IsDelete    = "0";
                RoleInfo.OtherStatus = "11111111111111111111111111111111";

                RoleInfo.EnableTime = DateTime.Parse(DateStart.Value.ToString());
                RoleInfo.EndTime    = DateTime.Parse(DateEnd.Value.ToString());

                RoleInfo.StrEnableTime = S1102App.EncryptString(RoleInfo.EnableTime.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                RoleInfo.StrEndTime    = S1102App.EncryptString(RoleInfo.EndTime.ToString("yyyy/MM/dd HH:mm:ss"));
                RoleInfo.CreatorID     = CurrentApp.Session.UserInfo.UserID;
                RoleInfo.CreatTime     = DateTime.Parse(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")).ToUniversalTime();
                mAsyncResult           = false;
                if (PageParent != null)
                {
                    PageParent.SetBusy(true, string.Empty);
                }
                mBackgroundWorker         = new BackgroundWorker();
                mBackgroundWorker.DoWork += (s, de) =>
                {
                    ShowStausMessage(CurrentApp.GetLanguageInfo("1102T00035", "Adding Role Information") + "....");
                    AddNewRoleInfo(RoleInfo);
                    #region 写操作日志

                    CurrentApp.WriteOperationLog(S1102Consts.OPT_AddRole.ToString(), ConstValue.OPT_RESULT_SUCCESS, msg);
                    #endregion
                };
                mBackgroundWorker.RunWorkerCompleted += (s, re) =>
                {
                    mBackgroundWorker.Dispose();
                    if (PageParent != null)
                    {
                        PageParent.SetBusy(false, string.Empty);
                    }

                    ShowStausMessage(CurrentApp.GetLanguageInfo("1102T00036", "Add Role Information End") + ".");
                    if (mAsyncResult)
                    {
                        if (PageParent != null)
                        {
                            PageParent.ReloadData();
                            PageParent.ShowObjectDetail();
                        }
                        var parent = Parent as PopupPanel;
                        if (parent != null)
                        {
                            parent.IsOpen = false;
                        }
                    }
                };
                mBackgroundWorker.RunWorkerAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }