Beispiel #1
0
        private void IniPage()
        {
            try
            {
                string unitCode = Request.QueryString["UnitCode"];
                string fullCode = DAL.EntityDAO.OBSDAO.GetUnitFullCode(unitCode);
                this.txtStationCode.Value = Request.QueryString["StationCode"];
                this.txthUnit.Value       = unitCode;
                this.txtUnitName.Value    = BLL.SystemRule.GetUnitName(unitCode);

                EntityData ds1 = OBSDAO.GetStandard_UnitByCode(unitCode);
                //this.rblRoleLevel.SelectedValue = ds1.GetString("UnitType");

                EntityData units = DAL.EntityDAO.OBSDAO.GetAllUnit();
                foreach (string tempCode in fullCode.Split(new char[] { '-' }))
                {
                    if (tempCode != "")
                    {
                        DataRow[] drsSelect = units.CurrentTable.Select(String.Format("UnitCode='{0}'", tempCode));
                        if (drsSelect.Length > 0)
                        {
                            this.sltAccessRangeUnit.Items.Add(new ListItem((string)drsSelect[0]["UnitName"], (string)drsSelect[0]["UnitCode"]));
                        }
                    }
                }
                units.Dispose();
                BLL.PageFacade.LoadAllRoleSelect(this.sltRole, "");
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "加载页面错误。"));
            }
        }
Beispiel #2
0
        public static string GetUnitU8Code(string UnitCode)
        {
            string text2;

            try
            {
                string text = "";
                if (UnitCode == "")
                {
                    return(text);
                }
                EntityData unitByCode = OBSDAO.GetUnitByCode(UnitCode);
                if (unitByCode.HasRecord())
                {
                    text = unitByCode.GetString("U8Code");
                }
                unitByCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #3
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            RoleStrategyName name            = (RoleStrategyName)strategy.Name;
            string           projectUnitCode = "";
            string           unitFullCode    = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case RoleStrategyName.ProjectCode:
                    projectUnitCode = ProjectDAO.GetProjectUnitCode(strategy.GetParameter(0));
                    return(string.Format(" exists ( select * from userRole where userrole.RoleCode = Role.RoleCode and unitCode ='{0}' )  ", unitFullCode));

                case RoleStrategyName.ProjectCodeEx:
                    unitFullCode = OBSDAO.GetUnitFullCode(ProjectDAO.GetProjectUnitCode(strategy.GetParameter(0)));
                    return(string.Format(" exists ( select * from userRole where userrole.RoleCode = Role.RoleCode and unitCode in ( select unitCode from unit where fullCode like '{0}%'))  ", unitFullCode));

                case RoleStrategyName.UnitCode:
                    unitFullCode = OBSDAO.GetUnitFullCode(strategy.GetParameter(0));
                    return(string.Format(" exists ( select * from userRole where userrole.RoleCode = Role.RoleCode and unitCode in ( select unitCode from unit where fullCode like '{0}%'))  ", unitFullCode));

                case RoleStrategyName.ModuleCode:
                    return(string.Format(" RoleCode in ( select RoleCode from RoleModule where ModuleCode='{0}' ) ", strategy.GetParameter(0)));

                case RoleStrategyName.UserCode:
                    return(string.Format(" RoleCode in ( select RoleCode from UserRole where UserCode='{0}' ) ", strategy.GetParameter(0)));
                }
                return("");
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Beispiel #4
0
        public static string GetUserStationNameHtml(string userCode)
        {
            string text7;

            try
            {
                EntityData stationByUserCode = OBSDAO.GetStationByUserCode(userCode);
                string     text  = "";
                int        count = stationByUserCode.CurrentTable.Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    stationByUserCode.SetCurrentRow(i);
                    string text2        = stationByUserCode.GetString("StationCode");
                    string unitFullName = GetUnitFullName(stationByUserCode.GetString("UnitCode"));
                    string text4        = stationByUserCode.GetString("unitCode");
                    string text5        = stationByUserCode.GetString("StationName");
                    string text6        = "../Systems/StationInfo.aspx?StationCode=" + text2 + "&UnitCode=" + text4 + "";
                    string text8        = text;
                    text = text8 + "<a style=\"CURSOR: hand\" onclick=OpenMyStaionSetWindow(\"" + text6 + "\")>" + unitFullName + "->" + text5 + "</a><br>";
                }
                stationByUserCode.Dispose();
                text7 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text7);
        }
Beispiel #5
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            UnitStrategyName name = (UnitStrategyName)strategy.Name;
            string           text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case UnitStrategyName.OnlyHasUser:
                    return(" dbo.GetUnitUserCount(UnitCode) > 0");

                case UnitStrategyName.SortID:
                    return(text);

                case UnitStrategyName.ProjectCode:
                    return(string.Format(" FullCode LIKE dbo.GetUnitFullCodeByProjectCode('{0}') + '%'", strategy.GetParameter(0)));

                case UnitStrategyName.UnderUnitCode:
                {
                    string unitFullCode = OBSDAO.GetUnitFullCode(strategy.GetParameter(0));
                    return(string.Format("  FullCode like '{0}%' ", strategy.GetParameter(0)));
                }
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Beispiel #6
0
        public static DataTable GetUnitListByUserCode(string UserCode)
        {
            DataTable table2;

            try
            {
                DataTable  tb     = new DataTable();
                DataColumn column = new DataColumn();
                tb.Columns.Add("UnitCode");
                tb.Columns.Add("UnitName");
                EntityData userRoleByUserCode = SystemManageDAO.GetUserRoleByUserCode(UserCode);
                foreach (DataRow row in userRoleByUserCode.CurrentTable.Rows)
                {
                    EntityData stationByCode = OBSDAO.GetStationByCode(row["StationCode"].ToString());
                    if (stationByCode.HasRecord())
                    {
                        DataRow row2 = tb.NewRow();
                        row2["UnitCode"] = stationByCode.GetString("UnitCode");
                        row2["UnitName"] = GetUnitName(stationByCode.GetString("UnitCode"));
                        tb.Rows.Add(row2);
                    }
                    stationByCode.Dispose();
                }
                userRoleByUserCode.Dispose();
                table2 = ConvertRule.GetDistinct(tb, "UnitCode", "");
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
Beispiel #7
0
        public static string GetUFUnitSubjectSetU8Code(string UFUnitCode, string SubjectSetCode)
        {
            string text2;

            try
            {
                string text = "";
                if (UFUnitCode == "")
                {
                    return(text);
                }
                EntityData unitSubjectSetByUnit = OBSDAO.GetUnitSubjectSetByUnit(UFUnitCode, SubjectSetCode);
                if (unitSubjectSetByUnit.HasRecord())
                {
                    text = unitSubjectSetByUnit.GetString("U8Code");
                }
                unitSubjectSetByUnit.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #8
0
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            ProjectStrategyName name = (ProjectStrategyName)strategy.Name;
            string text = "";

            if (strategy.Type == StrategyType.Other)
            {
                switch (name)
                {
                case ProjectStrategyName.False:
                    return("1=2");

                case ProjectStrategyName.ProjectCode:
                    return(text);

                case ProjectStrategyName.ProjectCodeNot:
                    return(string.Format("ProjectCode <> '{0}'", strategy.GetParameter(0)));

                case ProjectStrategyName.ProjectCodeIn:
                    return(string.Format("ProjectCode in ('{0}')", strategy.GetParameter(0).Replace(",", "','")));

                case ProjectStrategyName.UnitCode:
                {
                    string unitFullCode = OBSDAO.GetUnitFullCode(strategy.GetParameter(0));
                    if (unitFullCode == "")
                    {
                        return(" 1 = 2");
                    }
                    return(string.Format(" projectCode in ( select relaCode from unit where unitType='项目' and FullCode like '{0}%' ) ", unitFullCode));
                }
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Beispiel #9
0
        public static string GetUnitParentSpecailUnitCode(string unitCode, string targetUnitType, ref string targetUnitName, ref string targetUnitFullCode)
        {
            string text7;

            try
            {
                string     text    = "";
                string     text2   = unitCode;
                EntityData allUnit = OBSDAO.GetAllUnit();
                while (text2 != "")
                {
                    DataRow[] rowArray = allUnit.CurrentTable.Select(string.Format("UnitCode='{0}'", text2));
                    if (rowArray.Length > 0)
                    {
                        string text3 = rowArray[0]["UnitType"].ToString();
                        string text4 = rowArray[0]["ParentUnitCode"].ToString();
                        string text5 = rowArray[0]["UnitName"].ToString();
                        string text6 = rowArray[0]["FullCode"].ToString();
                        if (text3 == targetUnitType)
                        {
                            text               = text2;
                            targetUnitName     = text5;
                            targetUnitFullCode = text6;
                            break;
                        }
                        text2 = text4;
                    }
                    else
                    {
                        text2 = "";
                    }
                }
                allUnit.Dispose();
                text7 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text7);
        }
Beispiel #10
0
        public static string GetUnitFullName(string code)
        {
            string text2;

            try
            {
                string     text = "";
                EntityData unitFullNameByUnitCode = OBSDAO.GetUnitFullNameByUnitCode(code);
                if (unitFullNameByUnitCode.HasRecord())
                {
                    text = unitFullNameByUnitCode.GetString("UnitFullName");
                }
                unitFullNameByUnitCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #11
0
        public static string GetUnitByStationCode(string stationCode)
        {
            string text2;

            try
            {
                string     text          = "";
                EntityData stationByCode = OBSDAO.GetStationByCode(stationCode);
                if (stationByCode.HasRecord())
                {
                    text = stationByCode.GetString("UnitCode");
                }
                stationByCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #12
0
        public static string GetStationNameEx(string stationCode)
        {
            string text4;

            try
            {
                string     text          = "";
                EntityData stationByCode = OBSDAO.GetStationByCode(stationCode);
                if (stationByCode.HasRecord())
                {
                    text = GetUnitFullName(stationByCode.GetString("UnitCode")) + "->" + stationByCode.GetString("StationName");
                }
                stationByCode.Dispose();
                text4 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text4);
        }
Beispiel #13
0
        public static string GetUnitSubjectSet(string unitCode, ref int isSelfAccount)
        {
            string text2;

            try
            {
                string     text       = "";
                EntityData unitByCode = OBSDAO.GetUnitByCode(unitCode);
                if (unitByCode.HasRecord())
                {
                    text          = unitByCode.GetString("SubjectSetCode");
                    isSelfAccount = unitByCode.GetInt("SelfAccount");
                }
                unitByCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #14
0
        public static string GetProjectSubjectSet(string projectCode, ref int isSelfAccount)
        {
            string text3;

            try
            {
                string     code       = SystemRule.GetProjectUnitCode(projectCode);
                string     text2      = "";
                EntityData unitByCode = OBSDAO.GetUnitByCode(code);
                if (unitByCode.HasRecord())
                {
                    text2         = unitByCode.GetString("SubjectSetCode");
                    isSelfAccount = unitByCode.GetInt("SelfAccount");
                }
                unitByCode.Dispose();
                text3 = text2;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Beispiel #15
0
        protected void btnDelete_ServerClick(object sender, System.EventArgs e)
        {
            string unitCode = Request["UnitCode"] + "";

            try
            {
                bool canDelete = true;
//				EntityData role = DAL.EntityDAO.SystemManageDAO.GetOBSRoleByUnitCode(unitCode);
//				if ( role.HasRecord() )
//					canDelete = false;
//				role.Dispose();

                EntityData childDepartment = DAL.EntityDAO.OBSDAO.GetOBSUnitByParent(unitCode);
                if (childDepartment.HasRecord())
                {
                    canDelete = false;
                }
                childDepartment.Dispose();

                if (!canDelete)
                {
                    Rms.Web.JavaScript.Alert(true, "这个部门下面设定有子部门和角色,不可删除 !");
                    return;
                }

                EntityData ds = OBSDAO.GetUnitByCode(unitCode);
                OBSDAO.DeleteUnit(ds);
                ds.Dispose();
                CloseWindow(true);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "删除出错"));
            }
        }
Beispiel #16
0
        private void LoadData()
        {
            string stationCode = txtStationCode.Value;
            string unitCode    = this.txthUnit.Value;

            try
            {
                bool       isNew = (stationCode == "");
                EntityData ds    = null;

                if (isNew)
                {
                    ds = new EntityData("Standard_Station");
                    DataRow dr = ds.GetNewRecord();
                    dr["StationCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("StationCode");
                    dr["UnitCode"]    = this.txthUnit.Value;
                    ds.AddNewRecord(dr);
                    ds.SetCurrentRow(0);
                }
                else
                {
                    ds = OBSDAO.GetStandard_StationByCode(stationCode);
                }
                //ds = OBSDAO.GetStandard_UnitByCode(unitCode);
                EntityData ds1 = OBSDAO.GetStandard_UnitByCode(unitCode);
                if (ds.HasRecord())
                {
                    this.txtStationName.Text = ds.GetString("StationName");
                    this.txtDescription.Text = ds.GetString("Description");
                    this.txthUnit.Value      = ds.GetString("UnitCode");

                    try
                    {
                        switch (ds1.GetString("UnitType"))
                        {
                        case "项目":
                            rblRoleLevel.SelectedValue = "0";
                            break;

                        case "部门":
                            rblRoleLevel.SelectedValue = "3";
                            break;

                        default:
                            rblRoleLevel.SelectedValue = "4";
                            break;
                        }
                        //this.rblRoleLevel.SelectedValue = ds.GetInt("RoleLevel").ToString();    //修改前
                    }
                    catch
                    {}
                    sltAccessRangeUnit.Value      = unitCode;
                    this.sltRole.Value            = ds.GetString("RoleCode");
                    this.sltAccessRangeUnit.Value = ds.GetString("AccessRangeUnitCode");
                }

                this.txtUnitName.Value = BLL.SystemRule.GetUnitName(this.txthUnit.Value);

                //记录当前的用户代码
                this.txtReturnUserCodes.Value = BLL.ConvertRule.Concat(ds.Tables["UserRole"], "UserCode", ",");

                this.dgList.DataSource = ds.Tables["UserRole"];
                this.dgList.DataBind();
                Session["StationEntityData"] = ds;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "加载页面错误。"));
            }
        }
        private void LoadData()
        {
            try
            {
                bool       isNew = (StationCode == "");
                EntityData ds    = null;

                if (isNew)
                {
                    ds = new EntityData("Standard_Station");
                    DataRow dr = ds.GetNewRecord();
                    dr["StationCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("StationCode");
                    dr["UnitCode"]    = this.txthUnit.Value;
                    ds.AddNewRecord(dr);
                    ds.SetCurrentRow(0);
                }
                else
                {
                    ds = OBSDAO.GetStandard_StationByCode(StationCode);
                }

                if (ds.HasRecord())
                {
                    this.lblStationName.Text = ds.GetString("StationName");
                    this.lblDescription.Text = ds.GetString("Description");
                    this.lblUnit.Text        = BLL.SystemRule.GetUnitName(ds.GetString("UnitCode"));
                    this.lblRoleName.Text    = BLL.SystemRule.GetRoleName(ds.GetString("RoleCode"));
                    int roleLevel = ds.GetInt("RoleLevel");
                    //Session["roleLevel"]=roleLevel;
                    ViewState["roleLevel"] = roleLevel;
                    string accessRangeUnitCode = ds.GetString("AccessRangeUnitCode");
                    if (roleLevel == 0)
                    {
                        this.lblRoleLevelName.Text = "集团";
                    }
                    else if (roleLevel == 4)
                    {
                        this.lblRoleLevelName.Text = "个人";
                    }
                    else
                    {
                        this.lblRoleLevelName.Text = "部门";
                    }

                    //this.lblRoleLevelName.Text = BLL.SystemRule.GetUnitName(accessRangeUnitCode);
                }
                this.txtUnitName.Value = BLL.SystemRule.GetUnitName(this.txthUnit.Value);

                //记录当前的用户代码
                this.txtReturnUserCodes.Value = BLL.ConvertRule.Concat(ds.Tables["UserRole"], "UserCode", ",");
                this.dgList.DataSource        = ds.Tables["UserRole"];
                this.dgList.DataBind();
                Session["StationEntityData"] = ds;
                ds.Dispose();
                //entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错"));
            }
        }
Beispiel #18
0
        private void LoadData()
        {
            string unitCode = Request["UnitCode"] + "";

            try
            {
                EntityData ds = OBSDAO.GetStandard_UnitByCode(unitCode);

                if (ds.HasRecord())
                {
                    this.lblSortID.Text   = ds.GetString("SortID");
                    this.lblUnitType.Text = ds.GetString("UnitType");

                    this.lblName.Text      = ds.GetString("UnitName");
                    this.lblPrincipal.Text = BLL.SystemRule.GetUserName(ds.GetString("Principal"));
                    this.lblRemark.Text    = ds.GetString("Remark");
                    //this.lblSubjectSet.Text = BLL.SubjectRule.GetSubjectSetName(ds.GetString("SubjectSetCode"));
                    if (ds.GetInt("SelfAccount") == 1)
                    {
                        this.lblSelfAccount.Text = "独立核算";
                    }

                    //显示财务编码
                    this.lblSubjectSetDesc.Text = BLL.FinanceRule.GetFinanceSubjectSetDesc(ds.Tables["UnitSubjectSet"]);

                    if (ds.GetString("UnitType") == "项目")
                    {
                        this.btnDelete.Visible = false;
                        //this.btnModify.Visible = false;
                        //this.trToolBar.Style["display"] = "none";
                        btnModify.Attributes["onclick"] = "javascript:ModifyProject(" + ds.GetString("RelaCode") + ");return false;";
                        EntityData projectds = ProjectDAO.GetProjectByCode(ds.GetString("RelaCode"));
                        this.lblSubjectSet.Text = BLL.SubjectRule.GetSubjectSetName(projectds.GetString("SubjectSetCode"));
                    }
                    else
                    {
                        //如果是部门则隐掉帐套
                        lblSubjectsettd.Visible  = false;
                        lblSelfAccount.Visible   = false;
                        lblSubjectSet.Visible    = false;
                        tdsubjectsetdesc.ColSpan = 3;
                    }
                }
                ds.Dispose();



                EntityData childUnit = DAL.EntityDAO.OBSDAO.GetOBSUnitByParent(unitCode);
                this.dgListChildUnit.DataSource = childUnit;
                this.dgListChildUnit.DataBind();
                childUnit.Dispose();

                EntityData station = DAL.EntityDAO.OBSDAO.GetStationByUnitCode(unitCode);
                station.CurrentTable.Columns.Add("RoleLevelName");
                int iCount = station.CurrentTable.Rows.Count;
                for (int i = 0; i < iCount; i++)
                {
                    station.SetCurrentRow(i);
                    int roleLevel = station.GetInt("RoleLevel");
                    station.CurrentRow["RoleLevelName"] = BLL.SystemRule.GetRoleLevelName(roleLevel);
                }

                this.dgConfig.DataSource = station;
                this.dgConfig.DataBind();
                station.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错:" + ex.Message));
            }
        }
Beispiel #19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string m_strGetType     = Request.QueryString["GetType"] + "";                              //数据分类
            string m_strUnitCode    = (Request.QueryString["UnitCode"] == null?"":Request.QueryString["UnitCode"]);
            string m_strLayers      = (Request.QueryString["Layers"] == null?"*":Request.QueryString["Layers"]);
            string m_strParentLayer = (Request.QueryString["ParentLayer"] == null?"0":Request.QueryString["ParentLayer"]);
            int    m_iParentLayer   = -1;

            if (m_strParentLayer != "")
            {
                m_iParentLayer = ToInt(m_strParentLayer);
            }

            string[] m_Layers = m_strLayers.Split('.');

            DataTable m_Table = new DataTable("Unit");

            m_Table.Columns.Add("Id");
            m_Table.Columns.Add("UnitName");
            m_Table.Columns.Add("Remark");
            m_Table.Columns.Add("Layer");
            m_Table.Columns.Add("ChildNodesCount");
            m_Table.Columns.Add("ShowChildNodes");
            m_Table.Columns.Add("PrincipalName");

            if (m_strGetType == "all")
            {
                DataRow m_NewRow = m_Table.NewRow();
                m_NewRow["Id"]              = "";
                m_NewRow["UnitName"]        = "所有部门";
                m_NewRow["Layer"]           = 1 + m_iParentLayer;
                m_NewRow["ChildNodesCount"] = 1;
                m_NewRow["ShowChildNodes"]  = 0;

                m_Table.Rows.Add(m_NewRow);
            }
            else
            {
                EntityData m_Unit = OBSDAO.GetOBSUnitByParent(m_strUnitCode);

                foreach (DataRow m_Row in m_Unit.Tables["Unit"].Rows)
                {
                    DataRow m_NewRow = m_Table.NewRow();
                    m_NewRow["Id"]            = m_Row["UnitCode"].ToString();
                    m_NewRow["UnitName"]      = m_Row["UnitName"].ToString();
                    m_NewRow["PrincipalName"] = m_Row["PrincipalName"].ToString();
                    m_NewRow["Remark"]        = m_Row["Remark"].ToString();

                    if (m_iParentLayer < 0)
                    {
                        m_NewRow["Layer"] = m_Row["Deep"].ToString();
                    }
                    else
                    {
                        m_NewRow["Layer"] = 1 + m_iParentLayer;
                    }

                    m_NewRow["ChildNodesCount"] = m_Row["ChildCount"].ToString();
                    m_NewRow["ShowChildNodes"]  = 0;

                    m_Table.Rows.Add(m_NewRow);
                }
                m_Unit.Dispose();
            }

            Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table));
            Response.End();
        }
Beispiel #20
0
        /// <summary>
        /// 生成SQL语句
        /// </summary>
        /// <param name="strategy"></param>
        /// <returns></returns>
        public override string BuildSingleStrategyString(Strategy strategy)
        {
            UserStrategyName name = (UserStrategyName)strategy.Name;
            string           text = "";

            if (strategy.Type == StrategyType.Other)
            {
                string text2        = "";
                string unitFullCode = "";
                string text4        = "";
                string text5        = "";
                string parameter    = "";
                switch (name)
                {
                case UserStrategyName.UserCodes:
                    return(string.Format(" UserCode in ( {0} )", strategy.GetParameter(0)));

                case UserStrategyName.UsersAndStations:
                    parameter = strategy.GetParameter(0);
                    text5     = strategy.GetParameter(1);
                    return(string.Format(" (  ( UserCode in ( {0} ) ) or   exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode in ( {1} )  ) ) ", parameter, text5));

                case UserStrategyName.UserID:
                case UserStrategyName.UserName:
                case UserStrategyName.PassWord:
                case UserStrategyName.OwnName:
                case UserStrategyName.Status:
                case UserStrategyName.Sex:
                case UserStrategyName.SortID:
                    return(text);

                case UserStrategyName.StationCode:
                {
                    string text7 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode ='{0}'  )  ", text7));
                }

                case UserStrategyName.StationCodes:
                    text5 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and UserRole.StationCode in ( {0} )  )  ", text5));

                case UserStrategyName.NoStation:
                    return(" not exists (select * from UserRole where UserRole.UserCode = SystemUser.UserCode)");

                case UserStrategyName.RoleCode:
                    text4 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and Station.RoleCode='{0}' ) ) ", strategy.GetParameter(0)));

                case UserStrategyName.ProjectCode:
                    unitFullCode = OBSDAO.GetUnitFullCode(ProjectDAO.GetProjectUnitCode(strategy.GetParameter(0)));
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and exists (  select 1 from Unit where Station.UnitCode=Unit.UnitCode and Unit.FullCode like '{0}%' ) ) )  ", unitFullCode));

                case UserStrategyName.UnitCodeEx:
                    unitFullCode = OBSDAO.GetUnitFullCode(strategy.GetParameter(0));
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and exists (  select 1 from Unit where Station.UnitCode=Unit.UnitCode and Unit.FullCode like '{0}%' ) ) )  ", unitFullCode));

                case UserStrategyName.UnitCode:
                    text2 = strategy.GetParameter(0);
                    return(string.Format("  exists ( select 1 from UserRole where UserRole.UserCode=SystemUser.UserCode and exists ( select 1 from Station where Station.StationCode=UserRole.StationCode and Station.UnitCode='{0}' ) )  ", text2));

                case UserStrategyName.WBSCode:
                    return(string.Format(" exists (select * from TaskPerson where TaskPerson.UserCode = [SystemUser].UserCode and TaskPerson.WBSCode ='{0}' and Type = 2 )", strategy.GetParameter(0)));

                case UserStrategyName.UserIdorUserName:
                    return(string.Format(" ( userid ='{0}' or username='******' )", Strategy.ReplaceSingleQuote(strategy.GetParameter(0))));
                }
                return(text);
            }
            return(StandardStrategyStringBuilder.BuildStrategyString(strategy));
        }
Beispiel #21
0
        private void LoadData()
        {
            ///////////权限
            string mainCode = "%";
            string roleCode = Request["RoleCode"] + "";

            try
            {
                EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode);

                FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder();
                sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode));
                sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0"));
                sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRightControlPoint, "0"));
                sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRoleControlPoint, "0"));

                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString());

                entity.CurrentTable.Columns.Add("ShowCode");
                qa.Dispose();

                string allCode = "";
                string aCode   = "";

                int iCount = entity.CurrentTable.Rows.Count;
                for (int i = 0; i < iCount; i++)
                {
                    entity.SetCurrentRow(i);
                    string code = entity.GetString("FunctionStructureCode");
                    int    deep = entity.GetInt("Deep");
                    entity.CurrentRow["ShowCode"] = BuildShowCode(deep);

                    int iA = entity.GetInt("IsAvailable");
                    if (allCode != "")
                    {
                        allCode += ",";
                    }

                    allCode += code;
                }

                role.SetCurrentTable("RoleOperation");
                foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode)))
                {
                    string code = (string)dr["OperationCode"];
                    if (aCode != "")
                    {
                        aCode += ",";
                    }
                    aCode += string.Format("'{0}'", code);
                }
                aCode = " FunctionStructureCode in (" + aCode + ") ";
                DataView dv = new DataView(entity.Tables["FunctionStructure"]);
                dv.RowFilter = aCode;
                this.rptFunction.DataSource = dv;
                this.rptFunction.DataBind();
                entity.Dispose();
                role.Dispose();
            }
            catch (Exception ex)
            {
                //ApplicationLog.WriteLog(this.ToString(), ex, "");
                //Response.Write(Rms.Web.JavaScript.Alert(true, "显示权限时发生出错"));
            }
            //////////////////////////////////

            try
            {
                EntityData ds = SystemManageDAO.GetRoleByCode(roleCode);
                if (ds.HasRecord())
                {
                    this.lblRoleName.Text    = ds.GetString("RoleName");
                    this.lblDescription.Text = ds.GetString("Description");
                    sortID.Text = ds.GetString("sortid");
                }
                ds.Dispose();

                EntityData entity = OBSDAO.GetStationByRoleCode(roleCode);
                this.dgList.DataSource = entity.CurrentTable;
                this.dgList.DataBind();
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错"));
            }
        }
Beispiel #22
0
        public static string SetResourceAccessRange(string code, string classCode, string unitCode, bool isRefreshRight)
        {
            string text5;

            try
            {
                string     resourceCode = GetResourceCode(code, classCode);
                bool       flag         = resourceCode == "";
                EntityData entity       = null;
                if (flag)
                {
                    resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode");
                    entity       = new EntityData("Standard_Resource");
                    DataRow newRecord = entity.GetNewRecord();
                    newRecord["ResourceCode"] = resourceCode;
                    newRecord["ClassCode"]    = classCode;
                    newRecord["UnitCode"]     = unitCode;
                    newRecord["RelationCode"] = code;
                    entity.AddNewRecord(newRecord);
                }
                else
                {
                    entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode);
                    entity.CurrentRow["unitCode"] = unitCode;
                }
                if (isRefreshRight)
                {
                    entity.DeleteAllTableRow("AccessRange");
                }
                EntityData stationByUnitAccess = OBSDAO.GetStationByUnitAccess(unitCode);
                entity.SetCurrentTable("AccessRange");
                foreach (DataRow row2 in stationByUnitAccess.CurrentTable.Rows)
                {
                    string     text2 = row2["RoleCode"].ToString();
                    string     text3 = row2["StationCode"].ToString();
                    EntityData data3 = SystemManageDAO.GetStandard_RoleByCode(text2);
                    foreach (DataRow row3 in data3.Tables["RoleOperation"].Select(string.Format(" SubString(OperationCode,1,4)='{0}' ", classCode)))
                    {
                        string  text4 = (string)row3["OperationCode"];
                        DataRow row   = entity.GetNewRecord();
                        row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode");
                        row["ResourceCode"]    = resourceCode;
                        row["UnitCode"]        = unitCode;
                        row["OperationCode"]   = text4;
                        row["AccessRangeType"] = 1;
                        row["RelationCode"]    = text3;
                        entity.AddNewRecord(row);
                    }
                    data3.Dispose();
                }
                stationByUnitAccess.Dispose();
                ResourceDAO.SubmitAllStandard_Resource(entity);
                entity.Dispose();
                text5 = resourceCode;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text5);
        }
Beispiel #23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                string   m_strGetType       = Request.QueryString["GetType"] + "";                      //数据分类
                string   m_strLayer         = Request.QueryString["Layer"] + "";                        //需要取的层数
                string   m_strNodeId        = Request.QueryString["NodeId"] + "";                       //父节点编号
                string[] m_Layers           = (Request.QueryString["Layers"] + "").Split('.');          //定点展开的序列
                string   m_strSelectedLayer = Request.QueryString["SelectedLayer"] + "";                //定层展开的深度

                string m_strCurrLayer   = Request.QueryString["CurrLayer"] + "";                        //当前节点的层数
                string m_strParentLayer = Request.QueryString["ParentLayer"] + "";                      //父节点的层数

                string m_strNotDisplayNull = Request.QueryString["NotDisplayNull"] + "";                //当人数为空时不显示该部门节点

                if (m_strCurrLayer != "")
                {
                    m_intCurrLayer = ToInt(m_strCurrLayer);
                }
                else
                {
                    m_intCurrLayer = ToInt(m_strParentLayer) + 1;
//					m_intCurrLayer = ToInt(m_strParentLayer) + 2;
                }

                m_strNodeId = DecodeId(m_strNodeId);

                DataTable m_Table = new DataTable("OBS");
                m_Table.Columns.Add("Code");
                m_Table.Columns.Add("SelfCode");
                m_Table.Columns.Add("Name");
                m_Table.Columns.Add("ParentCode");
                m_Table.Columns.Add("Description");
                m_Table.Columns.Add("Layer");
                m_Table.Columns.Add("ChildNodesCount");
                m_Table.Columns.Add("ShowChildNodes");
                m_Table.Columns.Add("NodeType");
                m_Table.Columns.Add("SortID");
                m_Table.Columns.Add("UserCount");
                m_Table.Columns.Add("ImageName");

                if (m_strGetType == "")
                {
                    #region 取第一层

                    m_strParentCode = "";
                    EntityData entity;

                    if (m_strNotDisplayNull == "1")
                    {
                        entity = OBSDAO.GetOBSUnitOnlyHasUserByParent(m_strNodeId);
                    }
                    else
                    {
                        entity = OBSDAO.GetOBSUnitByParent(m_strNodeId);
                    }
                    DataTable m_DataTable = entity.CurrentTable;

                    foreach (DataRow dr in m_DataTable.Rows)
                    {
                        //用户数为0时,该节点不显示
//						int UserCount = 0;
//						if (m_DataTable.Columns.Contains("UserCount"))
//						{
//							UserCount = BLL.ConvertRule.ToInt(dr["UserCount"]);
//						}
//
//						if ((UserCount > 0) || (m_strNotDisplayNull != "1"))
//						{
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
//						}
                    }

                    entity.Dispose();

                    #endregion
                }
                else if (m_strGetType == "ChildNodesOnlyUnit")
                {
                    #region 取部门节点下的子部门(ChildCount只统计子部门数,不统计岗位数)

                    m_strParentCode = m_strNodeId;
                    EntityData entity;

                    if (m_strNotDisplayNull == "1")
                    {
                        entity = OBSDAO.GetUnitOnlyHasUserByParent(m_strNodeId);
                    }
                    else
                    {
                        entity = OBSDAO.GetUnitByParent(m_strNodeId);
                    }
                    DataTable m_DataTable = entity.CurrentTable;

                    foreach (DataRow dr in m_DataTable.Rows)
                    {
                        //用户数为0时,该节点不显示
//						int UserCount = 0;
//						if (m_DataTable.Columns.Contains("UserCount"))
//						{
//							UserCount = BLL.ConvertRule.ToInt(dr["UserCount"]);
//						}
//
//						if ((UserCount > 0) || (m_strNotDisplayNull != "1"))
//						{
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
//						}
                    }

                    entity.Dispose();

                    #endregion
                }
                else if (m_strGetType == "ChildNodes")
                {
                    #region 取部门节点下的子部门(ChildCount统计子部门数+岗位数)

                    m_strParentCode = m_strNodeId;
                    EntityData entity;

                    if (m_strNotDisplayNull == "1")
                    {
                        entity = OBSDAO.GetOBSUnitOnlyHasUserByParent(m_strNodeId);
                    }
                    else
                    {
                        entity = OBSDAO.GetOBSUnitByParent(m_strNodeId);
                    }
                    DataTable m_DataTable = entity.CurrentTable;

                    foreach (DataRow dr in m_DataTable.Rows)
                    {
                        //用户数为0时,该节点不显示
//						int UserCount = 0;
//						if (m_DataTable.Columns.Contains("UserCount"))
//						{
//							UserCount = BLL.ConvertRule.ToInt(dr["UserCount"]);
//						}
//
//						if ((UserCount > 0) || (m_strNotDisplayNull != "1"))
//						{
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
//						}
                    }

                    entity.Dispose();

                    #endregion
                }
                else if (m_strGetType == "ChildNodesRoleOfUnit")
                {
                    #region 取部门节点下的岗位

                    m_strParentCode = m_strNodeId;

                    EntityData entity      = OBSDAO.GetStationByUnitCode(m_strNodeId);
                    DataTable  m_DataTable = entity.CurrentTable;

                    foreach (DataRow dr in m_DataTable.Rows)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRoleRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
                    }

                    entity.Dispose();

                    #endregion
                }
                //				else if(m_strGetType=="ChildNodesUserOfRole")
                //				{
                //					#region 取角色节点下的子用户
                //
                //					m_strParentCode = m_strNodeId;
                //
                //					EntityData entity = SystemManageDAO.GetSystemUserByRoleCode(m_strNodeId);
                //					DataTable m_DataTable=entity.CurrentTable;
                //
                //					foreach(DataRow dr in m_DataTable.Rows)
                //					{
                //						DataRow m_NewRow = m_Table.NewRow();
                //
                //						this.FillUserRow(ref m_NewRow,dr);
                //
                //						m_Table.Rows.Add(m_NewRow);
                //					}
                //
                //					entity.Dispose();
                //
                //					#endregion
                //				}
                else if (m_strGetType == "SingleNode")
                {
                    #region 单个部门节点

                    EntityData entity      = OBSDAO.GetOBSUnitByCode(m_strNodeId);
                    DataTable  m_DataTable = entity.CurrentTable;
                    if (m_DataTable.Rows.Count > 0)
                    {
                        DataRow dr       = m_DataTable.Rows[0];
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
                    }

                    entity.Dispose();

                    #endregion
                }
                else if (m_strGetType == "SingleNodeRole")
                {
                    #region 单个岗位节点

                    EntityData entity      = OBSDAO.GetStationByCode(m_strNodeId);
                    DataTable  m_DataTable = entity.CurrentTable;
                    if (m_DataTable.Rows.Count > 0)
                    {
                        DataRow dr       = m_DataTable.Rows[0];
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRoleRow(ref m_NewRow, dr);

                        m_Table.Rows.Add(m_NewRow);
                    }

                    entity.Dispose();

                    #endregion
                }
                else if (m_strGetType == "NoStationUser")
                {
                    #region 未定岗人员

                    int        UserCount = 0;
                    EntityData entity    = BLL.SystemRule.GetUsersNoStation();
                    UserCount = entity.CurrentTable.Rows.Count;
                    entity.Dispose();

                    if ((UserCount > 0) || (m_strNotDisplayNull != "1"))
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        m_NewRow["Code"]       = "D_NoStationUser";
                        m_NewRow["SelfCode"]   = m_NewRow["Code"];
                        m_NewRow["Name"]       = "未定岗人员";
                        m_NewRow["Layer"]      = m_intCurrLayer;
                        m_NewRow["ParentCode"] = "";

                        m_NewRow["UserCount"] = UserCount;

                        m_NewRow["ChildNodesCount"] = 0;
                        m_NewRow["ShowChildNodes"]  = "0";

                        m_NewRow["SortID"] = "";

                        m_NewRow["ImageName"] = "user.gif";
                        m_NewRow["NodeType"]  = "";

                        m_Table.Rows.Add(m_NewRow);
                    }

                    #endregion
                }
//				else if(m_strGetType=="SingleNodeUser")
//				{
//					#region 单个用户节点
//
//					EntityData entity = SystemManageDAO.GetSystemUserByCode(m_strNodeId);
//					DataTable m_DataTable=entity.CurrentTable;
//					if (m_DataTable.Rows.Count > 0)
//					{
//						DataRow dr = m_DataTable.Rows[0];
//						DataRow m_NewRow = m_Table.NewRow();
//
//						this.FillUserRow(ref m_NewRow,dr);
//
//						m_Table.Rows.Add(m_NewRow);
//					}
//
//					entity.Dispose();
//
//					#endregion
//				}

                Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table));

/*  注释掉  2004.5.26  begin---------------------------------------------------------------------------------
 *                              string m_strUnitCode=(Request.QueryString["UnitCode"]==null?"":Request.QueryString["UnitCode"]);
 *                              string m_strLayers=(Request.QueryString["Layers"]==null?"*":Request.QueryString["Layers"]);
 *                              string m_strLayer=(Request.QueryString["Layer"]==null?"0":Request.QueryString["Layer"]);
 *                              string[] m_Layers=m_strLayers.Split('.');
 *
 *                              DataTable m_Table=new DataTable("Unit");
 *                              m_Table.Columns.Add("UnitCode");
 *                              m_Table.Columns.Add("UnitName");
 *                              m_Table.Columns.Add("Remark");
 *                              m_Table.Columns.Add("Layer");
 *                              m_Table.Columns.Add("ChildNodesCount");
 *                              m_Table.Columns.Add("ShowChildNodes");
 *                              m_Table.Columns.Add("PrincipalName");
 *
 *                              //			EntityData m_Unit=OBSDAO.GetUnitByParent(base.ProjectCode,m_strUnitCode);
 *                              EntityData m_Unit=OBSDAO.GetUnitByParent(m_strUnitCode);
 *
 *                              foreach(DataRow m_Row in m_Unit.Tables["Unit"].Rows)
 *                              {
 *                                      DataRow m_NewRow = m_Table.NewRow();
 *                                      m_NewRow["UnitCode"]=m_Row["UnitCode"].ToString();
 *                                      m_NewRow["UnitName"]=m_Row["UnitName"].ToString();
 *                                      m_NewRow["PrincipalName"]=m_Row["PrincipalName"].ToString();
 *                                      m_NewRow["Remark"]=m_Row["Remark"].ToString();
 *                                      m_NewRow["Layer"]=m_Row["Deep"].ToString();
 *                                      m_NewRow["ChildNodesCount"]=m_Row["ChildCount"].ToString();
 *                                      m_NewRow["ShowChildNodes"]=0;
 *                                      m_Table.Rows.Add(m_NewRow);
 *
 *                              }
 *                              m_Unit.Dispose();
 *
 *                              Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table));
 *                              Response.End();
 * 注释掉  2004.5.26  end---------------------------------------------------------------------------------*/
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "加载组织结构错误。" + ex.Message);
            }

            Response.End();
        }