public Sys_FunctionMaster_fum_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            Sys_FunctionMaster_fum_Info fum = new Sys_FunctionMaster_fum_Info();
            Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
            fum = KeyObject as Sys_FunctionMaster_fum_Info;
            try
            {

                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    IQueryable<Sys_FunctionMaster_fum> taQuery =
                        (from ta in db.Sys_FunctionMaster_fum
                         where ta.fum_iRecordID == fum.fum_iRecordID
                         //orderby dpms.dpm_iRecordID ascending
                         select ta).Take(1);

                    if (taQuery != null)
                    {
                        //foreach (var t in taQuery)
                        foreach (Sys_FunctionMaster_fum t in taQuery)
                        {
                            info = Common.General.CopyObjectValue<Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(t);
                            FindFormPurview(info);
                        }
                    }
                    return info;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();

                info.fum_cFunctionNumber = txtcNum.Text;

                DataBind(_sysFunctionMasterBL.SearchRecords(info));
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
        /// <summary>
        /// 新增權限功能
        /// </summary>
        /// <param name="funcInfo">功能信息</param>
        /// <param name="sqlTrans">數據庫事務對象</param>
        /// <returns></returns>
        public bool AddFunction(Sys_FunctionMaster_fum_Info funcInfo, SqlTransaction sqlTrans)
        {
            bool res = false;

            if (funcInfo != null && !string.IsNullOrEmpty(funcInfo.fum_cFunctionNumber) && sqlTrans != null)
            {
                StringBuilder strSql = new StringBuilder();
                strSql.AppendLine("INSERT INTO Sys_FunctionMaster_fum(fum_cFunctionNumber,fum_cFunctionDesc,fum_cRemark,fum_cAdd,fum_dAddDate,fum_cLast,fum_dLastDate) VALUES (@cFunctionNumber,@cFunctionDesc,@cRemark,@cAdd,GETDATE(),@cLast,GETDATE())");

                try
                {
                    List<SqlParameter> parameters = new List<SqlParameter>();

                    parameters.Add(DbHelperSQL.MakeInParam("@cFunctionNumber", SqlDbType.VarChar, 30, funcInfo.fum_cFunctionNumber.Trim()));

                    string strFuncName = string.Empty;
                    if (!string.IsNullOrEmpty(funcInfo.fum_cFunctionDesc))
                    {
                        strFuncName = funcInfo.fum_cFunctionDesc;
                    }
                    parameters.Add(DbHelperSQL.MakeInParam("@cFunctionDesc", SqlDbType.NVarChar, 100, strFuncName.Trim()));

                    string strRemark = string.Empty;
                    if (!string.IsNullOrEmpty(funcInfo.fum_cRemark))
                    {
                        strRemark = funcInfo.fum_cRemark;
                    }
                    parameters.Add(DbHelperSQL.MakeInParam("@cRemark", SqlDbType.NVarChar, 200, strRemark.Trim()));

                    string strAdd = string.Empty;
                    if (!string.IsNullOrEmpty(funcInfo.fum_cAdd))
                    {
                        strAdd = funcInfo.fum_cAdd;
                    }
                    parameters.Add(DbHelperSQL.MakeInParam("@cAdd", SqlDbType.NVarChar, 40, strAdd.Trim()));
                    parameters.Add(DbHelperSQL.MakeInParam("@cLast", SqlDbType.NVarChar, 40, strAdd.Trim()));

                    int iRes = DbHelperSQL.ExecuteNonQuery(sqlTrans, CommandType.Text, strSql.ToString(), parameters.ToArray());
                    if (iRes == 1)
                    {
                        return true;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return res;
        }
        private void btnSelect_Click(object sender, EventArgs e)
        {
            Sys_FunctionMaster_fum_Info smcitem = null;
            _RtvInfo = new List<Sys_FunctionMaster_fum_Info>();
            try
            {
                if (lvwMstr.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < lvwMstr.SelectedItems.Count; i++)
                    {
                        smcitem = new Sys_FunctionMaster_fum_Info();
                        smcitem.fum_iRecordID = Convert.ToInt32(lvwMstr.SelectedItems[i].SubItems[(int)enmLvwMaster.fum_iRecordID].Text);
                        smcitem.fum_cFunctionNumber = lvwMstr.SelectedItems[i].SubItems[(int)enmLvwMaster.fum_cFunctionNumber].Text;
                        smcitem.fum_cFunctionDesc = lvwMstr.SelectedItems[i].SubItems[(int)enmLvwMaster.fum_cFunctionDesc].Text;
                        _RtvInfo.Add(smcitem);
                    }
                }

            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
            this.DialogResult = DialogResult.OK;
        }
        /// <summary>
        /// 新增權限功能
        /// </summary>
        /// <param name="strFuncCode">功能編碼</param>
        /// <param name="strFuncName">功能名稱</param>
        /// <param name="strAdd">新增人</param>
        /// <returns></returns>
        public ReturnValueInfo AddFunction(string strFuncCode, string strFuncName, string strAdd)
        {
            ReturnValueInfo rvInfo = new ReturnValueInfo();

            if (string.IsNullOrEmpty(strFuncCode))
            {
                rvInfo.messageText = "新增失敗,功能編碼不能為空。";
                return rvInfo;
            }

            if (string.IsNullOrEmpty(strFuncName))
            {
                rvInfo.messageText = "新增失敗,功能名稱不能為空。";
                return rvInfo;
            }

            try
            {
                using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
                {
                    SqlTransaction transaction = null;
                    conn.Open();
                    transaction = conn.BeginTransaction();

                    bool resOpt = false;
                    try
                    {
                        Sys_FunctionMaster_fum_Info funcInfo = new Sys_FunctionMaster_fum_Info();
                        funcInfo.fum_cFunctionNumber = strFuncCode.Trim();
                        funcInfo.fum_cFunctionDesc = strFuncName.Trim();
                        funcInfo.fum_cRemark = string.Empty;
                        funcInfo.fum_cAdd = strAdd;
                        funcInfo.fum_cLast = strAdd;

                        resOpt = this._RolesFuctionSettingDAL.AddFunction(funcInfo, transaction);
                        rvInfo.boolValue = resOpt;
                    }
                    catch (Exception exSql)
                    {
                        throw exSql;
                    }
                    finally
                    {
                        rvInfo.boolValue = resOpt;
                        if (resOpt)
                        {
                            transaction.Commit();
                        }
                        else
                        {
                            transaction.Rollback();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                rvInfo.isError = true;
                rvInfo.messageText = "新增失敗," + ex.Message;
            }
            return rvInfo;
        }
        public Sys_FunctionMaster_fum_Info GetRecord_First()
        {
            try
            {

                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    IQueryable<Sys_FunctionMaster_fum> taQuery =
                        (from ta in db.Sys_FunctionMaster_fum
                         orderby ta.fum_iRecordID ascending
                         select ta).Take(1);
                    Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
                    if (taQuery.Count() > 0)
                    {
                        foreach (var t in taQuery)
                        {
                            info = Common.General.CopyObjectValue<Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(t);
                            FindFormPurview(info);
                        }
                    }
                    return info;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        private Sys_FunctionMaster_fum_Info FindFormPurview(Sys_FunctionMaster_fum_Info info)
        {
            string sqlString = string.Empty;
            sqlString += "SELECT fom_cFormNumber,fom_cFormDesc " + Environment.NewLine;
            sqlString += "FROM Sys_FormMaster_fom " + Environment.NewLine;
            sqlString += "LEFT JOIN  Sys_FormPurview_frp" + Environment.NewLine;
            sqlString += "ON fom_cFormNumber=frp_cFormNumber" + Environment.NewLine;
            sqlString += "LEFT JOIN Sys_FunctionMaster_fum" + Environment.NewLine;
            sqlString += "ON frp_cFunctionNumber=fum_cFunctionNumber WHERE fum_iRecordID='" + info.fum_iRecordID + "'";

            IEnumerable<Sys_FormMaster_fom_Info> infos = null;
            List<Sys_FormMaster_fom_Info> infoList = null;

            try
            {
                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    infos = db.ExecuteQuery<Sys_FormMaster_fom_Info>(sqlString, new object[] { });

                    if (infos != null)
                    {
                        infoList = infos.ToList<Sys_FormMaster_fom_Info>();
                    }
                    foreach (Sys_FormMaster_fom_Info t in infoList)
                    {
                        info.formMaster.Add(t);
                    }
                    return info;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        public bool UpdateRecord(Sys_FunctionMaster_fum_Info infoObject)
        {
            using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
            {
                Sys_FunctionMaster_fum fum = new Sys_FunctionMaster_fum();
                try
                {

                    //fum = db.Sys_FunctionMaster_fum.SingleOrDefault(t => t.fum_iRecordID == infoObject.fum_iRecordID);

                    //for (int i = 0; i < fum.Sys_FormPurview_frps.Count; i++)
                    //{
                    //    Sys_FormPurview_frp sta = fum.Sys_FormPurview_frps[i];
                    //    db.Sys_FormPurview_frps.DeleteOnSubmit(sta);
                    //}

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

                    //info = Common.General.CopyObjectValue<Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(fum);

                    IEnumerable<Sys_FunctionMaster_fum_Info> IEfum = null;
                    IEnumerable<Sys_FormPurview_frp_Info> IEfrp = null;

                    sqlString += "UPDATE Sys_FunctionMaster_fum" + Environment.NewLine;
                    sqlString += " SET fum_cFunctionNumber='" + infoObject.fum_cFunctionNumber + "'," + Environment.NewLine;
                    sqlString += " fum_cFunctionDesc='" + infoObject.fum_cFunctionDesc + "'," + Environment.NewLine;
                    sqlString += " fum_cRemark='" + infoObject.fum_cRemark + "'," + Environment.NewLine;
                    sqlString += " fum_cLast='" + infoObject.fum_cLast + "'," + Environment.NewLine;
                    sqlString += " fum_dLastDate='" + infoObject.fum_dLastDate.Value.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine;

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

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

                    sqlString = string.Empty;
                    sqlString += "DELETE FROM Sys_FormPurview_frp WHERE frp_cFunctionNumber='" + infoObject.fum_cFunctionNumber + "'";
                    IEfrp = db.ExecuteQuery<Sys_FormPurview_frp_Info>(sqlString, new object[] { });

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

                            string frp_code = infoObject.fum_cFunctionNumber + fomInfo.fom_cFormNumber;

                            sqlString += "INSERT INTO Sys_FormPurview_frp" + Environment.NewLine;
                            sqlString += "(frp_cPurviewCode, frp_cFunctionNumber, frp_cFormNumber)" + Environment.NewLine;
                            sqlString += " VALUES " + Environment.NewLine;
                            sqlString += "('" + frp_code + "','" + infoObject.fum_cFunctionNumber + "','" + fomInfo.fom_cFormNumber + "')";

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

                    //if (fum != null)
                    //{
                    //    ////usm = Common.General.SetDataToLingQEntity(usm, infoObject);//时间溢出
                    //    //rlm.rlm_cRoleDesc = infoObject.rlm_cRoleDesc;
                    //    //rlm.rlm_cLast = infoObject.rlm_cLast;
                    //    //rlm.rlm_dLastDate = infoObject.rlm_dLastDate;

                    //    fum.fum_cFunctionNumber = infoObject.fum_cFunctionNumber;
                    //    fum.fum_cFunctionDesc = infoObject.fum_cFunctionDesc;
                    //    fum.fum_cRemark = infoObject.fum_cRemark;

                    //    fum.fum_cLast = infoObject.fum_cLast;
                    //    fum.fum_dLastDate = infoObject.fum_dLastDate.Value;

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

                    //            Sys_FormMaster_fom_Info usmInfo = infoObject.formMaster[i];

                    //            Sys_FormPurview_frp item = new Sys_FormPurview_frp();

                    //            item.frp_cFunctionNumber = infoObject.fum_cFunctionNumber;
                    //            item.frp_cFormNumber = usmInfo.fom_cFormNumber;

                    //            item.frp_cPurviewCode = item.frp_cFunctionNumber + item.frp_cFormNumber;
                    //            //courseitem.cum_cNumber;
                    //            fum.Sys_FormPurview_frps.Add(item);
                    //            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                    //        }
                    //    }

                    //    db.SubmitChanges();
                    //}
                    return true;
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Example #9
0
        private void ToolBar_BtnSearchClick(object sender, EventArgs e)
        {
            SysFunctionMasterSearch win = new SysFunctionMasterSearch();
            win.ShowDialog();

            if (win.DialogResult == DialogResult.OK)
            {
                //iRecordID = win.displayRecordID;
                iRecordID = win._RtvInfo[0].fum_iRecordID.ToString();
                Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
                try
                {
                    info.fum_iRecordID = Convert.ToInt32(iRecordID);
                    Model.IModel.IModelObject result = _sysFunctionMasterBL.DisplayRecord(info);
                    info = result as Sys_FunctionMaster_fum_Info;
                }
                catch (Exception Ex)
                {
                    ShowErrorMessage(Ex);
                }
                this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
                SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                SetOpenToolBar();
                ShowInfo(info);
            }

            win.Dispose();
            win = null;
        }
Example #10
0
        private void ToolBar_BtnSaveClick(object sender, EventArgs e)
        {
            Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo();
            Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
            Sys_FormMaster_fom_Info fomInfo = null;
            if (ChecktxtcName())
            {
                if (txtcCode.Text == string.Empty)
                {
                    msg.messageText = "功能编号" + Common.DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
                    ShowWarningMessage(msg.messageText);
                    txtcCode.Focus();
                }
                else
                {
                    try
                    {
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            info.fum_iRecordID = Convert.ToInt32(iRecordID);
                        }
                        info.fum_cFunctionNumber = txtcCode.Text;
                        info.fum_cFunctionDesc = txtcDesc.Text;

                        for (int i = 0; i < lvwFrom.Items.Count; i++)
                        {
                            fomInfo = new Sys_FormMaster_fom_Info();
                            fomInfo.fom_cFormNumber = lvwFrom.Items[i].SubItems[0].Text;
                            //userInfo.cum_cName = lvwMaster.Items[i].SubItems[1].Text;
                            info.formMaster.Add(fomInfo);
                        }

                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
                        {
                            info.fum_cAdd = UserInformation.usm_cUserLoginID;
                            info.fum_dAddDate = DateTime.Now;
                        }
                        info.fum_cLast = UserInformation.usm_cUserLoginID;
                        info.fum_dLastDate = DateTime.Now;
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            msg = _sysFunctionMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Update);
                        }
                        else
                        {
                            msg = _sysFunctionMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Insert);
                            if (msg.boolValue)
                            {
                                Handel(DefineConstantValue.GetReocrdEnum.GR_Last);
                            }
                        }

                        if (msg.messageText != null)
                            ShowInformationMessage(msg.messageText);
                        else
                        {
                            SetOpenToolBar();
                            SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                        }
                    }
                    catch (Exception Ex)
                    { ShowErrorMessage(Ex); }
                }
            }
        }
Example #11
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_FunctionMaster_fum_Info Info = new Sys_FunctionMaster_fum_Info();
            try
            {
                comkey.KeyValue = iRecordID;
                if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0")
                {
                    Info.fum_iRecordID = Convert.ToInt32(comkey.KeyValue);
                    _sysFunctionMasterBL.Save(Info, Common.DefineConstantValue.EditStateEnum.OE_Delete);

                    // SetOpenToolBar();
                    Handel(Common.DefineConstantValue.GetReocrdEnum.GR_Next);
                    if (Info.fum_iRecordID == int.Parse(iRecordID))
                    {
                        Handel(DefineConstantValue.GetReocrdEnum.GR_Previous);
                    }
                    SetOpenToolBar();
                    if (Info.fum_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); }
        }
Example #12
0
        private void ToolBar_BtnCancelClick(object sender, EventArgs e)
        {
            this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
            Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo();
            Sys_FunctionMaster_fum_Info Info = new Sys_FunctionMaster_fum_Info();
            try
            {
                comkey.KeyValue = iRecordID;
                if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0")
                {
                    Info.fum_iRecordID = Convert.ToInt32(comkey.KeyValue);
                    Model.IModel.IModelObject result = _sysFunctionMasterBL.DisplayRecord(Info);
                    Info = result as Sys_FunctionMaster_fum_Info;
                    ShowInfo(Info);
                    SetOpenToolBar();
                    SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                }

                else
                {
                    Handel(DefineConstantValue.GetReocrdEnum.GR_Last);
                }
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
Example #13
0
        /// <summary>
        /// 顯示數據
        /// </summary>
        /// <param name="info"></param>
        private void ShowInfo(Sys_FunctionMaster_fum_Info info)
        {
            try
            {
                if (info != null)
                {
                    iRecordID = info.fum_iRecordID.ToString();
                    txtcAdd.Text = info.fum_cAdd.ToString();
                    txtcLast.Text = info.fum_cLast.ToString();

                    txtcCode.Text = info.fum_cFunctionNumber.ToString();
                    txtcDesc.Text = info.fum_cFunctionDesc.ToString();

                    lvwFrom.Items.Clear();

                    lvwFrom.SetDataSource<Sys_FormMaster_fom_Info>(info.formMaster);

                    txtdAddDate.Text = info.fum_dAddDate != null ? info.fum_dAddDate.Value.ToString(Common.DefineConstantValue.gc_DateFormat) : string.Empty;
                    txtdLastDate.Text = info.fum_dLastDate != null ? info.fum_dLastDate.Value.ToString(Common.DefineConstantValue.gc_DateFormat) : string.Empty;
                }
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
Example #14
0
        /// <summary>
        /// 獲取用戶所擁有的權限列表
        /// </summary>
        /// <param name="userID">用戶ID</param>
        /// <returns></returns>
        List<Sys_FunctionMaster_fum_Info> GetUserFunctionList(string userID)
        {
            List<Sys_FunctionMaster_fum_Info> functionList = null;

            string strSql = string.Empty;

            strSql = " SELECT rfs_cFunctionNumber FROM Sys_UserRoles_usr with(Nolock) " + Environment.NewLine;
            strSql += " INNER JOIN Sys_RolesFuctionSetting_rfs ON usr_cRoleID=rfs_cRoleID " + Environment.NewLine;
            strSql += " WHERE usr_cUserLoginID= '" + Common.General.HandleSqlSingle(userID.Trim()) + "' ";

            try
            {
                using (IDataReader dataReader = DbHelperSQL.ExecuteReader(strSql))
                {
                    functionList = new List<Sys_FunctionMaster_fum_Info>();

                    while (dataReader.Read())
                    {
                        Sys_FunctionMaster_fum_Info function = new Sys_FunctionMaster_fum_Info();
                        function.fum_cFunctionNumber = dataReader["rfs_cFunctionNumber"].ToString().Trim();

                        functionList.Add(function);
                    }

                    dataReader.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return functionList;
        }
Example #15
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);
            }
        }
Example #16
0
        private void SysToolBar_BtnSaveClick(object sender, EventArgs e)
        {
            Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info();
            Sys_FunctionMaster_fum_Info frmInfo = null;
            if (ChecktxtcName())
            {
                if (txtcCode.Text == string.Empty)
                {
                    _msg.messageText = "表单编号" + Common.DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
                    ShowWarningMessage(_msg.messageText);
                    txtcCode.Focus();
                }
                else if (txtcDesc.Text == string.Empty)
                {
                    _msg.messageText = "表单描述" + Common.DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
                    ShowWarningMessage(_msg.messageText);
                    txtcDesc.Focus();
                }
                else
                {
                    try
                    {
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            info.fom_iRecordID = Convert.ToInt32(_iRecordID);
                        }
                        info.fom_cFormNumber = txtcCode.Text;
                        info.fom_cFormDesc = txtcDesc.Text;
                        info.fom_cExePath = txtcPath.Text;

                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            info.fom_iParentID = Convert.ToInt32(_pCode);
                        }
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
                        {
                            if (txtcParentCode.Text != string.Empty)
                            {
                                //info.fom_iParentID = Convert.ToInt32(_pCode);
                                info.fom_iParentID = Convert.ToInt32(txtcParentCode.Text);
                            }
                            else
                            {
                                info.fom_iParentID = 0;
                            }
                        }
                        info.fom_iIndex = Convert.ToInt32(txtcID.Text);

                        for (int i = 0; i < lvwPur.Items.Count; i++)
                        {
                            frmInfo = new Sys_FunctionMaster_fum_Info();
                            frmInfo.fum_cFunctionNumber = lvwPur.Items[i].SubItems[0].Text;
                            //userInfo.cum_cName = lvwMaster.Items[i].SubItems[1].Text;
                            info.functionMaster.Add(frmInfo);
                        }

                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
                        {
                            info.fom_cAdd = UserInformation.usm_cUserLoginID;
                            info.fom_dAddDate = DateTime.Now;
                        }
                        info.fom_cLast = UserInformation.usm_cUserLoginID;
                        info.fom_dLastDate = DateTime.Now;
                        if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
                        {
                            _msg = _ISysFormMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Update);
                        }
                        else
                        {
                            _msg = _ISysFormMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Insert);
                        }

                        if (_msg.messageText != null)
                            ShowInformationMessage(_msg.messageText);
                        else
                        {
                            SetOpenToolBar();
                            SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                        }
                        BindTreeView();
                    }
                    catch (Exception Ex)
                    { ShowErrorMessage(Ex); }
                }
            }
            BindTreeView();
        }
        public bool InsertRecord(Sys_FunctionMaster_fum_Info infoObject)
        {
            using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
            {
                Sys_FunctionMaster_fum fum = new Sys_FunctionMaster_fum();
                try
                {
                    fum = Common.General.CopyObjectValue<Sys_FunctionMaster_fum_Info, Sys_FunctionMaster_fum>(infoObject);

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

                            Sys_FormMaster_fom_Info usmInfo = infoObject.formMaster[i];

                            Sys_FormPurview_frp item = new Sys_FormPurview_frp();

                            item.frp_cFunctionNumber = infoObject.fum_cFunctionNumber;
                            item.frp_cFormNumber = usmInfo.fom_cFormNumber;

                            item.frp_cPurviewCode = item.frp_cFunctionNumber + item.frp_cFormNumber;
                            //courseitem.cum_cNumber;
                            //fum.Sys_FormPurview_frps.Add(item);
                            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                        }
                    }

                    db.Sys_FunctionMaster_fum.InsertOnSubmit(fum);
                    db.SubmitChanges();
                    return true;
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
 private void DataBind(List<Model.IModel.IModelObject> list)
 {
     Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
     lvwMstr.Items.Clear();
     List<Sys_FunctionMaster_fum_Info> infoList = new List<Sys_FunctionMaster_fum_Info>();
     try
     {
         foreach (var t in list)
         {
             info = t as Sys_FunctionMaster_fum_Info;
             infoList.Add(info);
         }
         lvwMstr.SetDataSource<Sys_FunctionMaster_fum_Info>(infoList);
     }
     catch (Exception Ex)
     { ShowErrorMessage(Ex); }
     lbliCount.Text = list.Count().ToString();
 }
Example #19
0
        /// <summary>
        /// 獲取指定角色ID的功能權限列表
        /// </summary>
        /// <param name="strRoleID">角色ID</param>
        /// <returns></returns>
        public List<Sys_FunctionMaster_fum_Info> GetFunctionListByRoleID(string strRoleID)
        {
            List<Sys_FunctionMaster_fum_Info> listFunctions = new List<Sys_FunctionMaster_fum_Info>();

            if (!string.IsNullOrEmpty(strRoleID))
            {
                StringBuilder strSql = new StringBuilder();
                strSql.AppendLine("select distinct fum_iRecordID,fum_cFunctionNumber,fum_cFunctionDesc,fum_cRemark");
                strSql.AppendLine(",fum_cAdd,fum_dAddDate,fum_cLast,fum_dLastDate");
                strSql.AppendLine("from Sys_FunctionMaster_fum with(nolock)");
                strSql.AppendLine("join Sys_RolesFuctionSetting_rfs with(nolock) on rfs_cFunctionNumber=fum_cFunctionNumber");
                strSql.AppendLine("join Sys_RoleMaster_rlm with(nolock) on rlm_cRoleID=rfs_cRoleID");
                strSql.AppendLine("where rfs_cRoleID='" + strRoleID.Trim() + "'");

                try
                {
                    using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSql.ToString()))
                    {
                        while (reader.Read())
                        {
                            Sys_FunctionMaster_fum_Info funcInfo = new Sys_FunctionMaster_fum_Info();

                            if (reader["fum_iRecordID"] != null && reader["fum_iRecordID"].ToString() != string.Empty)
                            {
                                funcInfo.fum_iRecordID = int.Parse(reader["fum_iRecordID"].ToString());
                            }
                            if (reader["fum_cFunctionNumber"] != null && reader["fum_cFunctionNumber"].ToString() != string.Empty)
                            {
                                funcInfo.fum_cFunctionNumber = reader["fum_cFunctionNumber"].ToString().Trim();
                            }
                            if (reader["fum_cFunctionDesc"] != null && reader["fum_cFunctionDesc"].ToString() != string.Empty)
                            {
                                funcInfo.fum_cFunctionDesc = reader["fum_cFunctionDesc"].ToString().Trim();
                            }
                            if (reader["fum_cRemark"] != null && reader["fum_cRemark"].ToString() != string.Empty)
                            {
                                funcInfo.fum_cRemark = reader["fum_cRemark"].ToString().Trim();
                            }
                            if (reader["fum_cAdd"] != null && reader["fum_cAdd"].ToString() != string.Empty)
                            {
                                funcInfo.fum_cAdd = reader["fum_cAdd"].ToString().Trim();
                            }
                            if (reader["fum_dAddDate"] != null && reader["fum_dAddDate"].ToString() != string.Empty)
                            {
                                funcInfo.fum_dAddDate = DateTime.Parse(reader["fum_dAddDate"].ToString().Trim());
                            }
                            if (reader["fum_cLast"] != null && reader["fum_cLast"].ToString() != string.Empty)
                            {
                                funcInfo.fum_cLast = reader["fum_cLast"].ToString().Trim();
                            }
                            if (reader["fum_dLastDate"] != null && reader["fum_dLastDate"].ToString() != string.Empty)
                            {
                                funcInfo.fum_dLastDate = DateTime.Parse(reader["fum_dLastDate"].ToString().Trim());
                            }

                            listFunctions.Add(funcInfo);
                        }
                    }
                }
                catch (Exception ex)
                {

                    throw ex;
                }
            }

            return listFunctions;
        }