Пример #1
0
        public static string GetUnitByProject(string projectCode)
        {
            string text3;

            try
            {
                string text = "";
                if (projectCode == "")
                {
                    return(text);
                }
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.RelaCode, projectCode));
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                if (data.HasRecord())
                {
                    text = data.GetString("UnitCode");
                }
                data.Dispose();
                text3 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Пример #2
0
        public static string GetSelfAccountUnitName(string subjectSetCode)
        {
            string text3;

            try
            {
                string text = "";
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.SubjectSetCode, subjectSetCode));
                builder.AddStrategy(new Strategy(UnitStrategyName.SelfAccount, "1"));
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                if (data.HasRecord())
                {
                    text = data.GetString("UnitName");
                }
                text3 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
Пример #3
0
        public static EntityData GetUnitAllChildAndSelf(string parentCode)
        {
            EntityData data3;

            try
            {
                string     text       = "";
                EntityData unitByCode = GetUnitByCode(parentCode);
                if (unitByCode.HasRecord())
                {
                    text = unitByCode.GetString("FullCode");
                }
                else
                {
                    text = "null";
                }
                unitByCode.Dispose();
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.UnderUnitCode, text));
                string     queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data2       = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data3 = data2;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data3);
        }
Пример #4
0
        public static EntityData GetAllCompanyUnit()
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.UnitType, "'公司'"));
                QueryAgent agent = new QueryAgent();
                EntityData data  = agent.FillEntityData("Unit", builder.BuildMainQueryString());
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #5
0
        public static EntityData GetUnitOnlyHasUserByParent(string parentCode)
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.ParentUnitCode, parentCode));
                string     queryString = builder.BuildQueryChildCountOnlyHasUserString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #6
0
        public static EntityData GetUnitFullNameByUnitCode(string unitCode)
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.UnitCode, unitCode));
                string     queryString = builder.BuildQueryFullNameString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #7
0
        public static EntityData GetUnitBySortID(string SortID)
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.SortID, SortID));
                string     queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #8
0
        public static EntityData GetUnitByProjectCode(string projectCode)
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.RelaCode, projectCode));
                string     queryString = builder.BuildMainQueryString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #9
0
        public static EntityData GetUnitUnderProject(string projectCode)
        {
            EntityData data2;

            try
            {
                string projectUnitCode      = GetProjectUnitCode(projectCode);
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.ParentUnitCode, projectUnitCode));
                builder.AddOrder("FullCode", true);
                QueryAgent agent = new QueryAgent();
                EntityData data  = agent.FillEntityData("Unit", builder.BuildMainQueryString());
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #10
0
        protected void btnDelete_ServerClick(object sender, System.EventArgs e)
        {
            try
            {
                string subjectSetCode  = this.txtSubjectSetCode.Value;
                bool   canDelete       = true;
                UnitStrategyBuilder sb = new UnitStrategyBuilder();
                sb.AddStrategy(new Strategy(UnitStrategyName.SubjectSetCode, subjectSetCode));
                string     sql    = sb.BuildMainQueryString();
                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("Unit", sql);
                qa.Dispose();

                if (entity.HasRecord())
                {
                    canDelete = false;
                }
                entity.Dispose();

                if (!canDelete)
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "还有公司使用这个帐套,不能删除 !"));
                    return;
                }

                EntityData subjectSet = DAL.EntityDAO.SubjectDAO.GetSubjectSetByCode(subjectSetCode);
                DAL.EntityDAO.SubjectDAO.DeleteSubjectSet(subjectSet);
                subjectSet.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "删除出错:" + ex.Message));
                return;
            }

            CloseWindow();
        }
Пример #11
0
        public static EntityData GetUnitByUnitName(string UnitName, string projectCode)
        {
            EntityData data2;

            try
            {
                UnitStrategyBuilder builder = new UnitStrategyBuilder();
                builder.AddStrategy(new Strategy(UnitStrategyName.UnitName, UnitName));
                if (projectCode != "")
                {
                    builder.AddStrategy(new Strategy(UnitStrategyName.ProjectCode, projectCode));
                }
                string     queryString = builder.BuildQueryChildCountString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Unit", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Пример #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string Value = Request.QueryString["Value"] + "";

            string UnitCode = "";
            string UnitName = "";
            string SortID   = "";
            string Hint     = "";
            string IsExists = "";

            if (Value != "")
            {
                //按编号查
                EntityData entity = DAL.EntityDAO.OBSDAO.GetUnitBySortID(Value);
                entity.Dispose();

                //按名称查
                if (!entity.HasRecord())
                {
                    entity = DAL.EntityDAO.OBSDAO.GetUnitByUnitName(Value);
                    entity.Dispose();
                }

                //按名称模糊查
                if (!entity.HasRecord())
                {
                    UnitStrategyBuilder sb = new UnitStrategyBuilder();

                    sb.AddStrategy(new Strategy(UnitStrategyName.UnitName, "%" + Value + "%"));

                    string sql = sb.BuildMainQueryString();

                    sql = sql + sb.GetDefaultOrder();

                    QueryAgent qa = new QueryAgent();
                    qa.SetTopNumber(1);
                    entity = qa.FillEntityData("Unit", sql);
                    qa.Dispose();
                }

                if (entity.HasRecord())
                {
                    UnitCode = entity.GetString("UnitCode");
                    UnitName = entity.GetString("UnitName");
                    SortID   = entity.GetString("SortID");
                    IsExists = "1";
                }
                else
                {
                    Hint = "部门不存在 !";
                }
            }

            string sResult = "<Result>"
                             + "<UnitCode>" + UnitCode + "</UnitCode>"
                             + "<UnitName>" + UnitName + "</UnitName>"
                             + "<SortID>" + SortID + "</SortID>"
                             + "<Hint>" + Hint + "</Hint>"
                             + "<IsExists>" + IsExists + "</IsExists>"
                             + "</Result>";

            Response.Write(sResult);
            Response.End();
        }
Пример #13
0
        private void IniPage()
        {
            try
            {
                this.txtProjectCode.Value = Request.QueryString["ProjectCode"];
                this.txtFromUrl.Value     = Request.QueryString["FromUrl"];

                if ("shimaopm" == this.up_sPMNameLower)
                {
                    this.TextBoxProjectName.Enabled = false;
                    bool IsSystemor = false;

                    EntityData entityRole = DAL.EntityDAO.OBSDAO.GetStationByUserCode(this.user.UserCode);
                    for (int i = 0; i < entityRole.CurrentTable.Rows.Count; i++)
                    {
                        if ("系统管理员" == entityRole.CurrentTable.Rows[i]["StationName"].ToString())
                        {
                            this.TextBoxProjectName.Enabled = true;
                            IsSystemor = true;
                            break;
                        }
                    }
                    if (!IsSystemor)
                    {
                        worningChange.InnerText = "非系统管理员不能修改项目名称";
                    }
                    entityRole.Dispose();
                }
                //RmsPM.BLL.PageFacade.LoadSubjectSetSelect(this.sltSubjectSet,"");

                RmsPM.BLL.PageFacade.LoadDictionarySelect(this.sltDevelopUnit, "建设单位", "");

//                if (AvailableFunction.isAvailableFunction("0604"))  //有营销系统接口
                if (BLL.ConvertRule.ToString(Application["SalServiceUrl"]) != "")  //有营销系统接口
                {
                    try
                    {
                        RmsPM.BLL.PageFacade.LoadSalSystemProjectSelect(this.sltSalProjectCode, "");
                    }
                    catch (Exception ex)
                    {
                        ApplicationLog.WriteLog(this.ToString(), ex, "初始化页面错误");
                        Response.Write(Rms.Web.JavaScript.Alert(true, "营销系统接口出错:" + ex.Message));
                    }
                }
                else //无营销
                {
                    this.lblSalProjectName0.Visible = false;
                    this.sltSalProjectCode.Visible  = false;
                }

                BLL.PageFacade.LoadProjectStatusSelect(this.SelectStatus, "0");

                UnitStrategyBuilder sb = new UnitStrategyBuilder();
                sb.AddStrategy(new Strategy(UnitStrategyName.UnitType, "'公司','部门'"));
                sb.AddOrder("FullCode", false);
                string     sql  = sb.BuildMainQueryString();
                QueryAgent qa   = new QueryAgent();
                EntityData unit = qa.FillEntityData("Unit", sql);
                qa.Dispose();

                //foreach ( DataRow dr in unit.CurrentTable.Rows)
                //{
                //    this.sltUnit.Items.Add( new ListItem( dr["UnitName"].ToString(),dr["UnitCode"].ToString() ));
                //}
                unit.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "初始化页面错误");
                Response.Write(Rms.Web.JavaScript.Alert(true, "初始化页面出错:" + ex.Message));
            }
        }