예제 #1
0
        public List<Sys_UserMaster_usm_Info> SearchRecords(Sys_UserMaster_usm_Info infoObj)
        {
            List<Sys_UserMaster_usm_Info> listReturn = null;

            try
            {
                string strSql = "select * from dbo.Sys_UserMaster_usm where 1=1 ";

                if(infoObj != null)
                {
                    if (!String.IsNullOrEmpty(infoObj.usm_cUserLoginID))
                    {
                        strSql += " and usm_cUserLoginID like %'" + infoObj.usm_cUserLoginID + "'% ";
                    }
                }

                IEnumerable<Sys_UserMaster_usm_Info> infos = null;

                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    infos = db.ExecuteQuery<Sys_UserMaster_usm_Info>(strSql, new object[] { });
                    if (infos != null)
                    {
                        listReturn = infos.ToList();
                    }
                }
            }
            catch
            {
                throw;
            }

            return listReturn;
        }
예제 #2
0
        public Model.SysMaster.Sys_UserMaster_usm_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            Sys_UserMaster_usm_Info usm = new Sys_UserMaster_usm_Info();
            Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();
            usm = KeyObject as Sys_UserMaster_usm_Info;
            try
            {

                using (MainDBDataContext db = new MainDBDataContext())
                {
                    IQueryable<Sys_UserMaster_usm> taQuery =
                        (from ta in db.Sys_UserMaster_usm
                         where ta.usm_iRecordID == usm.usm_iRecordID
                         //orderby dpms.dpm_iRecordID ascending
                         select ta).Take(1);

                    if (taQuery != null)
                    {
                        //foreach (var t in taQuery)
                        foreach (Sys_UserMaster_usm t in taQuery)
                        {
                            info = Common.General.CopyObjectValue<Sys_UserMaster_usm, Sys_UserMaster_usm_Info>(t);
                            FindUserRole(info);
                        }
                    }
                    return info;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
예제 #3
0
파일: DockMenu.cs 프로젝트: Klutzdon/PBIMSN
        public DockMenu(DockPanel dockPanel, Sys_UserMaster_usm_Info userInfo)
        {
            try
            {
                if (userInfo.usm_cUserLoginID.ToUpper() == "SA")
                {
                    treeNodeInfos = SystemMenuBLLFactory.Instance.GetISystemMenuBLL().GetMenuTreeNodes(CustEnum.System.HBManager);
                }
                else
                {
                    treeNodeInfos = SystemMenuBLLFactory.Instance.GetISystemMenuBLL().CheckUser(userInfo, CustEnum.System.HBManager);
                }

                foreach (TreeNodeInfo node in treeNodeInfos)
                {
                    if (node.Name == "SystemMenu")
                    {
                        node.Index = 4;
                    }
                    MenuToolForm mtf = new MenuToolForm(dockPanel, node, userInfo);
                    menuToolForms.Add(mtf);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
예제 #4
0
        public Sys_UserMaster_usm_Info FindPermission(Model.IModel.IModelObject KeyObject)
        {
            Sys_UserMaster_usm_Info usm = new Sys_UserMaster_usm_Info();
            Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();
            usm = KeyObject as Sys_UserMaster_usm_Info;
            try
            {
                using (MainDBDataContext db = new MainDBDataContext())
                {
                    IQueryable<Sys_UserMaster_usm> taQuery =
                        (from ta in db.Sys_UserMaster_usm
                         where ta.usm_cUserLoginID == usm.usm_cUserLoginID && ta.usm_cPasswork == usm.usm_cPasswork
                         //orderby dpms.dpm_iRecordID ascending
                         select ta).Take(1);

                    if (taQuery != null)
                    {
                        foreach (Sys_UserMaster_usm t in taQuery)
                        {
                            info = Common.General.CopyObjectValue<Sys_UserMaster_usm, Sys_UserMaster_usm_Info>(t);
                            FindForm(info);
                            FindFunction(info);
                        }
                    }
                    return info;
                }
            }
            catch
            {
                throw;
            }
        }
예제 #5
0
 void Login()
 {
     ILoginFormBL objILoginFormBL = BLL.Factory.SysMaster.MasterBLLFactory.GetBLL<ILoginFormBL>(BLL.Factory.SysMaster.MasterBLLFactory.LoginForm);
     ReturnValueInfo msg = new ReturnValueInfo();
     Sys_UserMaster_usm_Info userInfo = new Sys_UserMaster_usm_Info();
     userInfo.usm_cUserLoginID = txtUserName.Text;
     userInfo.usm_cPasswork = txtPwd.Text;
     try
     {
         msg = objILoginFormBL.Login(userInfo);
         if (msg.boolValue == true)
         {
             Session["UserInfo"] = userInfo;
             Response.Redirect("~/Main.aspx");
         }
         else
         {
             Session["UserInfo"] = null;
             txtPwd.Focus();
             txtPwd.Text = string.Empty;
             lblMsg.Text = msg.messageText.Trim();
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = "系統異常:" + getShortCutErrMsgDesc(ex);
     }
 }
예제 #6
0
        public void ShowForm(Sys_UserMaster_usm_Info userInfo, PayRecord_prd_Info showInfo, Common.DefineConstantValue.EditStateEnum statc)
        {
            this.UserInformation = userInfo;

            this._editInfo = showInfo;

            this.EditState = statc;

            this.ShowDialog();
        }
예제 #7
0
 public Sys_UserMaster_usm_Info FindAllPermission(Sys_UserMaster_usm_Info usm)
 {
     try
     {
         FindAllForm(usm);
         FindAllFunction(usm);
         return usm;
     }
     catch
     {
         throw;
     }
 }
예제 #8
0
        public TreeNodeInfo[] CheckUser(Sys_UserMaster_usm_Info userInfo)
        {
            TreeNodeInfo[] treeNodeInfos = null;
            if (userInfo.usm_cUserLoginID.ToUpper()== "SA")
            {
                treeNodeInfos = GetMenuTreeNodes();
            }
            else
            {
                treeNodeInfos = GetMenuTreeNodes(userInfo);
            }

            return treeNodeInfos;
        }
예제 #9
0
        public TreeNodeInfo[] GetMenuTreeNodes(Sys_UserMaster_usm_Info userInfo)
        {
            TreeNodeInfo[] treeNodeInfos = null;

            try
            {
                treeNodeInfos = _systemMenuDA.GetMenuTreeNodes(userInfo);
            }
            catch
            {
                throw;
            }

            return treeNodeInfos;
        }
예제 #10
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();

                info.usm_cUserLoginID = txtcNum.Text;
                info.usm_cChaName = txtcChinaName.Text;
                info.usm_cEmail = txtcEmail.Text;

                DataBind(_ISysUserMasterBL.SearchRecords(info));
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
예제 #11
0
 public bool SaveRecord(Sys_UserMaster_usm_Info infoObj)
 {
     try
     {
         using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
         {
             LinqToSQLModel.Sys_UserMaster_usm newTab = Common.General.CopyObjectValue<Sys_UserMaster_usm_Info, LinqToSQLModel.Sys_UserMaster_usm>(infoObj);
             db.Sys_UserMaster_usm.InsertOnSubmit(newTab);
             db.SubmitChanges();
         }
         return true;
     }
     catch
     {
         throw;
     }
 }
예제 #12
0
        public MenuToolForm(DockPanel dockPanel, TreeNodeInfo parentNode, Sys_UserMaster_usm_Info userInfo)
        {
            InitializeComponent();

            this._loginFormBL = MasterBLLFactory.GetBLL<ILoginFormBL>(MasterBLLFactory.LoginForm);
            this._childrenForms = new Dictionary<string, BaseForm>();
            this._dockPanel = dockPanel;

            this._parentNode = parentNode;
            //
            this._userInfo = userInfo;
            //
            UserInformation = userInfo;

            InitializeOutlookbar(userInfo);

            this.Text = parentNode.Text;
            this.TabText = parentNode.Text;

            //TONO: 便貼停靠位置
            this.Show(this._dockPanel, DockState.DockBottom);
            this.DockState = DockState.DockBottomAutoHide;
        }
예제 #13
0
        public bool InsertRecord(Model.SysMaster.Sys_UserMaster_usm_Info infoObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                Sys_UserMaster_usm usm = new Sys_UserMaster_usm();
                try
                {
                    usm = Common.General.CopyObjectValue <Sys_UserMaster_usm_Info, Sys_UserMaster_usm>(infoObject);


                    if (infoObject.roleMasterList != null && infoObject.roleMasterList.Count > 0)
                    {
                        for (int i = 0; i < infoObject.roleMasterList.Count; i++)
                        {
                            Sys_RoleMaster_rlm_Info usmInfo = infoObject.roleMasterList[i];

                            Sys_UserRoles_usr item = new Sys_UserRoles_usr();

                            item.usr_cUserLoginID = infoObject.usm_cUserLoginID;
                            item.usr_cRoleID      = usmInfo.rlm_cRoleID;
                            //courseitem.cum_cNumber;
                            usm.Sys_UserRoles_usrs.Add(item);
                            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                        }
                    }


                    db.Sys_UserMaster_usms.InsertOnSubmit(usm);
                    db.SubmitChanges();
                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
예제 #14
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();

                if (!string.IsNullOrEmpty(txtcNum.Text))
                {
                    info.usm_cUserLoginID = "*" + txtcNum.Text + "*";
                }
                if (!string.IsNullOrEmpty(txtcChinaName.Text))
                {
                    info.usm_cChaName = "*" + txtcChinaName.Text + "*";
                }
                if (!string.IsNullOrEmpty(txtcEmail.Text))
                {
                    info.usm_cEMail = "*" + txtcEmail.Text + "*";
                }

                DataBind(_ISysUserMasterBL.SearchRecords(info));
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
예제 #15
0
 public List<Sys_UserMaster_usm_Info> SearchRecords(Sys_UserMaster_usm_Info infoObj)
 {
     return _iumDA.SearchRecords(infoObj);
 }
예제 #16
0
 public bool SaveRecord(Sys_UserMaster_usm_Info infoObj)
 {
     return _iumDA.SaveRecord(infoObj);
 }
예제 #17
0
        public void ShowForm(Sys_UserMaster_usm_Info userInfo)
        {
            this.UserInformation = userInfo;

            this.ShowDialog();
        }
예제 #18
0
        void Change()
        {
            Sys_FunctionMaster_fum_Info fumInfo = new Sys_FunctionMaster_fum_Info();
            usmTemp = new Sys_UserMaster_usm_Info();
            rlmTemp = new Sys_RoleMaster_rlm_Info();

            try
            {
                if (_lvwUserType == UserType.User.ToString())
                {
                    usmTemp.usm_cUserLoginID = _num;
                    usmTemp.functionMasterList.Clear();
                    for (int i = 0; i < lvwPur.Items.Count; i++)
                    {
                        if (lvwPur.Items[i].Checked == true)
                        {
                            fumInfo = new Sys_FunctionMaster_fum_Info();
                            fumInfo.fum_cFunctionNumber = lvwPur.Items[i].SubItems[0].Text;
                            usmTemp.functionMasterList.Add(fumInfo);
                        }
                    }
                    for (int i = 0; i < uspInfoTemp.userMasterList.Count; i++)
                    {
                        if (uspInfoTemp.userMasterList[i].usm_cUserLoginID == _num)
                        {
                            uspInfoTemp.userMasterList[i] = usmTemp;
                        }
                    }
                }
                else
                {
                    rlmTemp.rlm_cRoleID = _num;
                    rlmTemp.functionMasterList.Clear();
                    for (int i = 0; i < lvwPur.Items.Count; i++)
                    {
                        if (lvwPur.Items[i].Checked == true)
                        {
                            fumInfo = new Sys_FunctionMaster_fum_Info();
                            fumInfo.fum_cFunctionNumber = lvwPur.Items[i].SubItems[0].Text;
                            rlmTemp.functionMasterList.Add(fumInfo);
                        }
                    }
                    for (int i = 0; i < uspInfoTemp.roleMasterList.Count; i++)
                    {
                        if (uspInfoTemp.roleMasterList[i].rlm_cRoleID == _num)
                        {
                            uspInfoTemp.roleMasterList[i] = rlmTemp;
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
 /// <summary>
 /// 刪除用戶
 /// </summary>
 void DeleteUser()
 {
     if (lvUsers.SelectedItems.Count > 0)
     {
         this._EditStatus = DefineConstantValue.EditStateEnum.OE_Delete;
         string strUserID = lvUsers.SelectedItems[0].SubItems[1].Text;
         if (this.ShowQuestionMessage("確定要刪除帳號【" + strUserID + "】嗎?"))
         {
             Sys_UserMaster_usm_Info user = new Sys_UserMaster_usm_Info();
             user.usm_iRecordID = Convert.ToInt32(lvUsers.SelectedItems[0].SubItems[0].Text);
             ReturnValueInfo rvInfo = this._ISysUserMasterBL.Save(user, DefineConstantValue.EditStateEnum.OE_Delete);
             if (rvInfo.boolValue && !rvInfo.isError)
             {
                 this.ShowInformationMessage("刪除成功。");
                 this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;
             }
             else
             {
                 this.ShowInformationMessage("刪除失敗。異常信息:" + rvInfo.messageText);
                 this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;
             }
         }
     }
 }
        private void btnSaveUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (this._EditStatus == DefineConstantValue.EditStateEnum.OE_Update)
                {
                    #region update user

                    Sys_UserMaster_usm_Info searchInfo = new Sys_UserMaster_usm_Info();
                    searchInfo.usm_iRecordID = this._CurrentUserID;
                    List<IModelObject> listObjUser = this._ISysUserMasterBL.SearchRecords(searchInfo);
                    if (listObjUser != null && listObjUser.Count > 0)
                    {
                        Sys_UserMaster_usm_Info user = listObjUser[0] as Sys_UserMaster_usm_Info;
                        if (user != null)
                        {
                            if (tbxPW.Text.Trim() != "")
                            {
                                user.usm_cPwd = tbxPW.Text.Trim();
                            }
                            user.usm_cChaName = tbxUserName.Text.Trim();
                            user.usm_cEmail = tbxUserEmail.Text.Trim();
                            user.usm_cRemark = tbxUserDescribe.Text.Trim();
                            user.usm_iLock = cbxUserEnabled.Checked;
                            user.usm_cLast = base.UserInformation != null ? base.UserInformation.usm_cUserLoginID : "sys";
                            user.usm_dLastDate = DateTime.Now;
                            ReturnValueInfo res = this._ISysUserMasterBL.Save(user, Common.DefineConstantValue.EditStateEnum.OE_Update);
                            if (res.boolValue && !res.isError)
                            {
                                this.ShowInformationMessage("修改用戶信息成功。");

                                this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;
                            }
                            else
                            {
                                this.ShowErrorMessage("修改用戶信息失敗,異常信息:" + res.messageText);
                            }
                        }
                        else
                        {
                            this.ShowErrorMessage("該用戶信息已被修改,請重新獲取用戶信息。");
                            btnCancelUser_Click(null, null);
                        }
                    }
                    else
                    {
                        this.ShowErrorMessage("該用戶信息已被修改,請重新獲取用戶信息。");
                        btnCancelUser_Click(null, null);
                    }

                    #endregion
                }
                else if (this._EditStatus == DefineConstantValue.EditStateEnum.OE_Insert)
                {
                    Sys_UserMaster_usm_Info user = new Sys_UserMaster_usm_Info();
                    user.usm_cUserLoginID = tbxUserID.Text.Trim();
                    if (string.IsNullOrEmpty(user.usm_cUserLoginID))
                    {
                        this.ShowWarningMessage("帳號ID不能為空。");
                        tbxUserID.Focus();
                        return;
                    }
                    Sys_UserMaster_usm_Info searchInfo = new Sys_UserMaster_usm_Info();
                    searchInfo.usm_cUserLoginID = user.usm_cUserLoginID;
                    List<IModelObject> listObj = this._ISysUserMasterBL.SearchRecords(searchInfo);
                    if (listObj != null && listObj.Count > 0)
                    {
                        this.ShowWarningMessage("已存在相同用戶ID。");
                        tbxUserID.Focus();
                        return;
                    }
                    user.usm_cChaName = tbxUserName.Text.Trim();
                    user.usm_cEmail = tbxUserEmail.Text.Trim();
                    user.usm_cRemark = tbxUserDescribe.Text.Trim();
                    user.usm_iLock = cbxUserEnabled.Checked;
                    user.usm_cPwd = tbxPW.Text;
                    user.usm_cAdd = base.UserInformation != null ? base.UserInformation.usm_cUserLoginID : "sys";
                    user.usm_dAddDate = DateTime.Now;
                    user.usm_cLast = base.UserInformation != null ? base.UserInformation.usm_cUserLoginID : "sys";
                    user.usm_dLastDate = DateTime.Now;
                    ReturnValueInfo res = this._ISysUserMasterBL.Save(user, Common.DefineConstantValue.EditStateEnum.OE_Insert);
                    if (res.boolValue && !res.isError)
                    {
                        this.ShowInformationMessage("新增用戶成功。");

                        this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;

                    }
                    else
                    {
                        this.ShowErrorMessage("新增用戶失敗,異常信息:" + res.messageText);
                    }

                    this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;
                }
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage("操作產生異常:" + ex.Message);
            }
            btnCancelUser_Click(null, null);
        }
        private void btnSaveFormRight_Click(object sender, EventArgs e)
        {
            string objID = string.Empty;

            List<Sys_UserPurview_usp_Info> saveList = new List<Sys_UserPurview_usp_Info>();

            List<Sys_UserMaster_usm_Info> userList = new List<Sys_UserMaster_usm_Info>();

            List<Sys_RoleMaster_rlm_Info> roleList = new List<Sys_RoleMaster_rlm_Info>();

            List<Sys_FormMaster_fom_Info> formList = new List<Sys_FormMaster_fom_Info>();

            #region MyRegion
            if (lvUserAndRole.SelectedItems != null && lvUserAndRole.SelectedItems.Count > 0)
            {
                foreach (ListViewItem item in lvUserAndRole.SelectedItems)
                {
                    if (item.SubItems[4].Text == Sys_UserAndRoleGeneral_Info.accountType.userID.ToString())
                    {
                        Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();

                        info.RecordID = Convert.ToInt32(item.SubItems[0].Text);

                        info.usm_cUserLoginID = item.SubItems[1].Text;

                        objID = info.usm_cUserLoginID;

                        userList.Add(info);

                        saveTypeID = Sys_UserAndRoleGeneral_Info.accountType.userID;
                    }
                    else
                    {
                        Sys_RoleMaster_rlm_Info info = new Sys_RoleMaster_rlm_Info();

                        info.rlm_iRecordID = Convert.ToInt32(item.SubItems[0].Text);

                        info.rlm_cRoleID = item.SubItems[1].Text;

                        objID = info.rlm_cRoleID;

                        roleList.Add(info);

                        saveTypeID = Sys_UserAndRoleGeneral_Info.accountType.roleID;
                    }
                }
            }
            #endregion

            HandelFormRight(tvFromMain2.Nodes[0], formList);

            foreach (Sys_UserMaster_usm_Info user in userList)
            {
                foreach (Sys_FormMaster_fom_Info form in formList)
                {
                    Sys_UserPurview_usp_Info info = new Sys_UserPurview_usp_Info();

                    info.usp_iFormID = form.fom_iRecordID;

                    info.usp_cUserLoginID = user.usm_cUserLoginID;

                    info.usp_cAdd = this.UserInformation.usm_cUserLoginID;

                    info.usp_cLast = this.UserInformation.usm_cUserLoginID;

                    saveList.Add(info);
                }
            }

            foreach (Sys_RoleMaster_rlm_Info role in roleList)
            {
                foreach (Sys_FormMaster_fom_Info form in formList)
                {
                    Sys_UserPurview_usp_Info info = new Sys_UserPurview_usp_Info();

                    info.usp_iFormID = form.fom_iRecordID;

                    info.usp_cRoleID = role.rlm_cRoleID;

                    info.usp_cAdd = this.UserInformation.usm_cUserLoginID;

                    info.usp_cLast = this.UserInformation.usm_cUserLoginID;

                    saveList.Add(info);
                }
            }

            try
            {
                ReturnValueInfo returnInfo = this._IUserPurviewBL.SavePruview(saveList, objID, saveTypeID);

                if (returnInfo.boolValue)
                {
                    ShowInformationMessage(DefineConstantValue.SystemMessageText.strMessageText_I_SaveSuccess);

                    gbFormTree.Enabled = false;

                    gbxUserAndRole.Enabled = true;

                    btnSaveFormRight.Enabled = false;

                    btnCancelFormRight.Enabled = false;

                    btnSetRight.Enabled = true;
                }
                else
                {
                    ShowErrorMessage(returnInfo.messageText);
                }
            }
            catch (Exception Ex)
            {

                ShowErrorMessage(Ex.Message);
            }
            this._EditStatus = DefineConstantValue.EditStateEnum.OE_ReaOnly;
        }
        /// <summary>
        /// 綁定用戶信息
        /// </summary>
        private void BindUserInfos()
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                Sys_UserMaster_usm_Info searchInfo = new Sys_UserMaster_usm_Info();
                List<IModelObject> listObjUser = this._ISysUserMasterBL.SearchRecords(searchInfo);
                List<Sys_UserMaster_usm_Info> listUsers = new List<Sys_UserMaster_usm_Info>();
                foreach (Sys_UserMaster_usm_Info userItem in listObjUser)
                {
                    if (userItem != null)
                    {
                        listUsers.Add(userItem);
                    }
                }
                this._ListUserMasterInfo = listUsers;
                lvUsers.SetDataSource<Sys_UserMaster_usm_Info>(listUsers);

                lvPurviewUser.SetDataSource(listUsers);

                this._isEdited = false;

                this._ListUserMasterInfo = listUsers;
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage("系統異常,異常信息:" + ex.Message);
                this.Cursor = Cursors.Default;
            }

            this.Cursor = Cursors.Default;
        }
예제 #23
0
        public bool UpdateRecord(Model.SysMaster.Sys_UserMaster_usm_Info infoObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                Sys_UserMaster_usm usm = new Sys_UserMaster_usm();
                try
                {
                    usm = db.Sys_UserMaster_usms.SingleOrDefault(t => t.usm_iRecordID == infoObject.usm_iRecordID);

                    for (int i = 0; i < usm.Sys_UserRoles_usrs.Count; i++)
                    {
                        Sys_UserRoles_usr sta = usm.Sys_UserRoles_usrs[i];
                        db.Sys_UserRoles_usrs.DeleteOnSubmit(sta);
                    }



                    string sqlString             = string.Empty;
                    Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();

                    info = Common.General.CopyObjectValue <Sys_UserMaster_usm, Sys_UserMaster_usm_Info>(usm);

                    IEnumerable <Sys_UserMaster_usm_Info> IEusm = null;
                    IEnumerable <Sys_UserRoles_usr_Info>  IEusr = null;

                    sqlString += "UPDATE Sys_UserMaster_usm" + Environment.NewLine;
                    sqlString += " SET usm_cUserLoginID='" + infoObject.usm_cUserLoginID + "'," + Environment.NewLine;
                    sqlString += " usm_cChaName='" + infoObject.usm_cChaName + "'," + Environment.NewLine;
                    sqlString += " usm_cPasswork='" + infoObject.usm_cPasswork + "'," + Environment.NewLine;
                    sqlString += " usm_cEMail='" + infoObject.usm_cEMail + "'," + Environment.NewLine;

                    sqlString += " usm_iLock='" + infoObject.usm_iLock + "'," + Environment.NewLine;
                    //sqlString += " fom_cExePath='" + infoObject.rlm_cLast + "'," + Environment.NewLine;
                    //sqlString += " usm_cRemark='" + infoObject.fom_iParentID + "'," + Environment.NewLine;
                    //sqlString += " fom_iIndex='" + infoObject.fom_iIndex + "'," + Environment.NewLine;
                    sqlString += " usm_cLast='" + infoObject.usm_cLast + "'," + Environment.NewLine;
                    sqlString += " usm_dLastDate='" + infoObject.usm_dLastDate.Value.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine;

                    sqlString += " WHERE usm_iRecordID='" + infoObject.usm_iRecordID + "'";

                    IEusm = db.ExecuteQuery <Sys_UserMaster_usm_Info>(sqlString, new object[] { });

                    sqlString  = string.Empty;
                    sqlString += "DELETE FROM Sys_UserRoles_usr WHERE usr_cUserLoginID='" + infoObject.usm_cUserLoginID + "'";
                    IEusr      = db.ExecuteQuery <Sys_UserRoles_usr_Info>(sqlString, new object[] { });


                    if (infoObject.roleMasterList != null && infoObject.roleMasterList.Count > 0)
                    {
                        for (int i = 0; i < infoObject.roleMasterList.Count; i++)
                        {
                            sqlString = string.Empty;
                            Sys_RoleMaster_rlm_Info rlmInfo = infoObject.roleMasterList[i];

                            sqlString += "INSERT INTO Sys_UserRoles_usr" + Environment.NewLine;
                            sqlString += "(usr_cUserLoginID, usr_cRoleID)" + Environment.NewLine;
                            sqlString += " VALUES " + Environment.NewLine;
                            sqlString += "('" + infoObject.usm_cUserLoginID + "','" + rlmInfo.rlm_cRoleID + "')";

                            IEusr = db.ExecuteQuery <Sys_UserRoles_usr_Info>(sqlString, new object[] { });
                        }
                    }



                    //if (usm != null)
                    //{
                    //    //usm = Common.General.SetDataToLingQEntity(usm, infoObject);//时间溢出
                    //    usm.usm_iLock = infoObject.usm_iLock;
                    //    usm.usm_cPasswork = infoObject.usm_cPasswork;
                    //    usm.usm_cEMail = infoObject.usm_cEMail;
                    //    usm.usm_cRemark = infoObject.usm_cRemark;
                    //    usm.usm_cLast = infoObject.usm_cLast;
                    //    usm.usm_dLastDate = infoObject.usm_dLastDate.Value;


                    //    if (infoObject.roleMasterList != null && infoObject.roleMasterList.Count > 0)
                    //    {
                    //        for (int i = 0; i < infoObject.roleMasterList.Count; i++)
                    //        {

                    //            Sys_RoleMaster_rlm_Info usmInfo = infoObject.roleMasterList[i];

                    //            Sys_UserRoles_usr item = new Sys_UserRoles_usr();

                    //            item.usr_cUserLoginID = infoObject.usm_cUserLoginID;
                    //            item.usr_cRoleID = usmInfo.rlm_cRoleID;
                    //            //courseitem.cum_cNumber;
                    //            usm.Sys_UserRoles_usrs.Add(item);
                    //            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                    //        }
                    //    }


                    //    db.SubmitChanges();
                    //}
                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
예제 #24
0
        private void ToolBar_BtnDeleteClick(object sender, EventArgs e)
        {
            this.EditState = DefineConstantValue.EditStateEnum.OE_Delete;
            Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo();
            Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo();
            Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo();
            Sys_UserMaster_usm_Info Info = new Sys_UserMaster_usm_Info();
            try
            {
                comkey.KeyValue = iRecordID;
                if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0")
                {
                    Info.usm_iRecordID = Convert.ToInt32(comkey.KeyValue);
                    _sysUserMasterBL.Save(Info, Common.DefineConstantValue.EditStateEnum.OE_Delete);

                    SetOpenToolBar();
                    Handel(Common.DefineConstantValue.GetReocrdEnum.GR_Next);
                    if (Info.usm_iRecordID == int.Parse(iRecordID))
                    {
                        Handel(DefineConstantValue.GetReocrdEnum.GR_Previous);
                    }
                    if (Info.usm_iRecordID == int.Parse(iRecordID))
                    {
                        SetOpenToolBar();
                        ToolBar.BtnPreviousEnabled = false;
                        ToolBar.BtnLastEnabled = false;
                        ToolBar.BtnFirstEnabled = false;
                        ToolBar.BtnNextEnabled = false;
                        ToolBar.BtnModifyEnabled = false;
                        ToolBar.BtnDeleteEnabled = false;
                        ToolBar.BtnSearchEnabled = false;
                    }
                }
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
예제 #25
0
        //顯示數據
        private void ShowInfo(Sys_UserMaster_usm_Info info)
        {
            try
            {
                if (info != null)
                {
                    iRecordID = info.usm_iRecordID.ToString();
                    txtcAdd.Text = info.usm_cAdd.ToString();
                    txtcLast.Text = info.usm_cLast.ToString();

                    if (info.usm_iLock == true)
                    {
                        chkLock.Checked = true;
                    }
                    else
                    {
                        chkLock.Checked = false;
                    }
                    txtUserID.Text = info.usm_cUserLoginID.ToString();
                    txtcName.Text = info.usm_cChaName.ToString();

                    pwd = info.usm_cPasswork.ToString();
                    txtcPwd.Text = string.Empty;

                    txtcMail.Text = info.usm_cEMail.ToString();

                    lvwMaster.Items.Clear();

                    lvwMaster.SetDataSource<Sys_RoleMaster_rlm_Info>(info.roleMasterList);

                    txtcRemark.Text = info.usm_cRemark.ToString();
                    txtdAddDate.Text = info.usm_dAddDate != null ? info.usm_dAddDate.Value.ToString(Common.DefineConstantValue.gc_DateFormat) : string.Empty;
                    txtdLastDate.Text = info.usm_dLastDate != null ? info.usm_dLastDate.Value.ToString(Common.DefineConstantValue.gc_DateFormat) : string.Empty;

                    //if (info.webUserIdentityBind != null)
                    //{
                    //    _guid = info.webUserIdentityBind.wui_Guid;
                    //    txtCardNum.Text = info.webUserIdentityBind.wui_CardUserNum;
                    //    cbisTrue.Checked = info.webUserIdentityBind.wui_Valid;
                    //}

                    Sys_UserMaster_usm_Info usmInfo = new Sys_UserMaster_usm_Info();
                    //usmInfo.usm_cUserLoginID = info.webUserIdentityBind.wui_CardUserNum;
                    usmInfo.usm_cUserLoginID = info.usm_cUserLoginID;

                    //FullDataRoleList();
                    groupBox5.Enabled = false;

                }
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
예제 #26
0
 public bool UpdateRecord(Sys_UserMaster_usm_Info infoObj)
 {
     return _iumDA.UpdateRecord(infoObj);
 }
예제 #27
0
        void SaveUSM()
        {
            Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo();
            Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();
            Sys_RoleMaster_rlm_Info userInfo = null;
            if (ChecktxtcName())
            {
                if (txtUserID.Text == string.Empty)
                {
                    msg.messageText = "登錄帳號" + Common.DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
                    ShowWarningMessage(msg.messageText);
                    txtUserID.Focus();
                }
                else if (txtcName.Text == string.Empty)
                {
                    msg.messageText = "中文名" + Common.DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
                    ShowWarningMessage(msg.messageText);
                    txtcName.Focus();
                }
                else
                {
                    try
                    {
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            info.usm_iRecordID = Convert.ToInt32(iRecordID);
                        }
                        info.usm_cUserLoginID = txtUserID.Text;
                        info.usm_cChaName = txtcName.Text;
                        if (txtcPwd.Text != string.Empty)
                        {
                            info.usm_cPasswork = Common.General.MD5(txtcPwd.Text);
                        }
                        else
                        {
                            if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
                                info.usm_cPasswork = Common.General.MD5(pwd);
                            else
                                info.usm_cPasswork = pwd;
                        }

                        info.usm_cEMail = txtcMail.Text;

                        info.usm_cRemark = txtcRemark.Text;

                        if (chkLock.Checked == true)
                        {
                            info.usm_iLock = true;
                        }
                        else
                        {
                            info.usm_iLock = false;
                        }
                        for (int i = 0; i < lvwMaster.Items.Count; i++)
                        {
                            userInfo = new Sys_RoleMaster_rlm_Info();
                            userInfo.rlm_cRoleID = lvwMaster.Items[i].SubItems[0].Text;
                            info.roleMasterList.Add(userInfo);
                        }
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
                        {
                            info.usm_cAdd = UserInformation.usm_cUserLoginID;
                            info.usm_dAddDate = DateTime.Now;
                        }
                        info.usm_cLast = UserInformation.usm_cUserLoginID;
                        info.usm_dLastDate = DateTime.Now;
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            msg = _sysUserMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Update);
                            isSaveTrue = msg.boolValue;
                        }
                        else
                        {
                            msg = _sysUserMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Insert);
                            isSaveTrue = msg.boolValue;
                        }

                        if (msg.messageText != null)
                            ShowInformationMessage(msg.messageText);
                        else
                        {
                            SetOpenToolBar();
                        }
                    }
                    catch (Exception Ex)
                    { ShowErrorMessage(Ex); }
                }
            }
        }
예제 #28
0
        public TreeNodeInfo[] GetMenuTreeNodes(Sys_UserMaster_usm_Info _usmInfo, CustEnum.System system)
        {
            List<Sys_FormMaster_fom_Info> infos = new List<Sys_FormMaster_fom_Info>();

            List<TreeNodeInfo> treeNodeInfoList = new List<TreeNodeInfo>();
            TreeNodeInfo rootNodeInfo = null;
            TreeNodeInfo[] treeNodeInfos = null;

            TreeNodeInfo itemNodeInfo = null;

            infos = _sysFormMasterDA.GetWinTreeNode(system.ToString());

            foreach (Sys_FormMaster_fom_Info inf in infos)
            {
                Sys_FormMaster_fom_Info info = inf;
                rootNodeInfo = new TreeNodeInfo();
                rootNodeInfo.Text = info.fom_cFormDesc;
                rootNodeInfo.Name = info.fom_cFormNumber;
                rootNodeInfo.Tag = info.fom_cExePath;
                rootNodeInfo.Index = info.fom_iIndex;

                rootNodeInfo.FileName = info.fom_iRecordID.ToString();

                TreeNodeInfo nodeInfo = null;
                info = new Sys_FormMaster_fom_Info();
                info.fom_iParentID = int.Parse(rootNodeInfo.FileName.ToString());

                /**/
                foreach (var chile in _sysFormMasterDA.SearchRecords(info))
                {
                    Sys_FormMaster_fom_Info fom = new Sys_FormMaster_fom_Info();
                    info = chile as Sys_FormMaster_fom_Info;
                    fom.fom_iParentID = info.fom_iRecordID;
                    if (_sysFormMasterDA.SearchRecords(fom, _usmInfo).Count > 0)
                    {
                        string Name = info.fom_iRecordID.ToString();
                        nodeInfo = null;
                        nodeInfo = LocalGeneralMenu.Instance.InsertTreeNode(rootNodeInfo, info.fom_cFormDesc, info.fom_cExePath, info.fom_cFormNumber, info.fom_iIndex, info.fom_iImageIndex);

                        foreach (var q in _sysFormMasterDA.SearchRecords(fom, _usmInfo))
                        {
                            info = q as Sys_FormMaster_fom_Info;

                            if (info.fom_cFormNumber.ToString().ToUpper() == "DEMO")
                            {
                                itemNodeInfo = LocalGeneralMenu.Instance.InsertTreeNode(nodeInfo, info.fom_cFormDesc, info.fom_cExePath, info.fom_cFormNumber, info.fom_iIndex, info.fom_iImageIndex);
                                itemNodeInfo.Remark = "EXE";
                                itemNodeInfo.FileName = "WPFUI\\WPFUI.exe";
                            }
                            else
                                LocalGeneralMenu.Instance.InsertTreeNode(nodeInfo, info.fom_cFormDesc, info.fom_cExePath, info.fom_cFormNumber, info.fom_iIndex, info.fom_iImageIndex);
                        }
                    }
                }

                /**/

                treeNodeInfoList.Add(rootNodeInfo);
            }
            treeNodeInfos = treeNodeInfoList.ToArray();
            return treeNodeInfos;
        }
예제 #29
0
        private void ToolBar_BtnCancelClick(object sender, EventArgs e)
        {
            this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
            Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo();
            Sys_UserMaster_usm_Info Info = new Sys_UserMaster_usm_Info();
            try
            {
                comkey.KeyValue = iRecordID;
                if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0")
                {
                    Info.usm_iRecordID = Convert.ToInt32(comkey.KeyValue);
                    Model.IModel.IModelObject result = _sysUserMasterBL.DisplayRecord(Info);
                    Info = result as Sys_UserMaster_usm_Info;
                    ShowInfo(Info);
                    SetOpenToolBar();
                    SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                }

                else
                {
                    Handel(DefineConstantValue.GetReocrdEnum.GR_Last);
                }
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
예제 #30
0
        public void ShowForm(Sys_UserMaster_usm_Info baseInfo)
        {
            this.UserInformation = baseInfo;

            ShowDialog();
        }
예제 #31
0
        private void ToolBar_BtnSearchClick(object sender, EventArgs e)
        {
            SysUserMasterSearch win = new SysUserMasterSearch();
            win.ShowDialog();

            if (win.DialogResult == DialogResult.OK)
            {
                //iRecordID = win.displayRecordID;
                iRecordID = win._RtvInfo[0].usm_iRecordID.ToString();
                Sys_UserMaster_usm_Info info = new Sys_UserMaster_usm_Info();
                try
                {
                    info.usm_iRecordID = Convert.ToInt32(iRecordID);
                    Model.IModel.IModelObject result = _sysUserMasterBL.DisplayRecord(info);
                    info = result as Sys_UserMaster_usm_Info;
                }
                catch (Exception Ex)
                {
                    ShowErrorMessage(Ex);
                }
                this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
                SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                SetOpenToolBar();
                ShowInfo(info);
            }
            win.Dispose();//釋放窗口
            win = null;
        }
 /// <summary>
 /// 獲得ListView中的用戶列表
 /// </summary>
 /// <param name="lvSource"></param>
 /// <returns></returns>
 List<Sys_UserMaster_usm_Info> GetRoleUserList(ListView lvSource)
 {
     List<Sys_UserMaster_usm_Info> listRes = new List<Sys_UserMaster_usm_Info>();
     foreach (ListViewItem item in lvSource.Items)
     {
         Sys_UserMaster_usm_Info user = new Sys_UserMaster_usm_Info();
         user.usm_iRecordID = Convert.ToInt32(item.SubItems[0].Text);
         user.usm_cUserLoginID = item.SubItems[1].Text;
         listRes.Add(user);
     }
     return listRes;
 }