Ejemplo n.º 1
0
        /// <summary>
        /// 根据操作员和申报单位取预算部门
        /// </summary>
        /// <param name="Usercoode"></param>
        /// <param name="Unit"></param>
        /// <returns></returns>
        public IList <OrganizeModel> GetDept(string Usercoode, string Unit)
        {
            Dictionary <string, object> dic_Corr = new Dictionary <string, object>();

            new CreateCriteria(dic_Corr)
            .Add(ORMRestrictions <String> .Eq("Dwdm", Usercoode))
            .Add(ORMRestrictions <String> .Eq("Dylx", "97"))
            .Add(ORMRestrictions <String> .LLike("Dydm", Unit));
            IList <CorrespondenceSettingsModel> correspondenceSettings = CorrespondenceSettingsRule.Find(dic_Corr);

            List <string> ocodeList = new List <string>();

            if (correspondenceSettings.Count > 0)
            {
                for (var i = 0; i < correspondenceSettings.Count; i++)
                {
                    if (!ocodeList.Contains(correspondenceSettings[i].Dydm))
                    {
                        ocodeList.Add(correspondenceSettings[i].Dydm);
                    }
                }
            }
            Dictionary <string, object> dic_org = new Dictionary <string, object>();

            new CreateCriteria(dic_org)
            .Add(ORMRestrictions <String> .Eq("IfCorp", "N"))
            .Add(ORMRestrictions <String> .Eq("IsActive", "1"))
            .Add(ORMRestrictions <List <String> > .In("OCode", ocodeList));
            IList <OrganizeModel> organizes = OrganizationRule.Find(dic_org);

            return(organizes);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 判断是否允许修改
        /// </summary>
        /// <returns></returns>
        public string JudgeCode()
        {
            string code = System.Web.HttpContext.Current.Request.Params["code"];
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic).Add(ORMRestrictions <string> .LLike("DM", code));
            IList <ProjLibProjModel> ProjLibProjList = ProjLibProjService.Find(dic).Data;

            if (ProjLibProjList.Count > 0)
            {
                var dmList = ProjLibProjList.ToList().Select(x => x.DM).ToList();
                Dictionary <string, object> dic2 = new Dictionary <string, object>();
                new CreateCriteria(dic2).Add(ORMRestrictions <List <string> > .In("FProjCode", dmList))
                .Add(ORMRestrictions <List <string> > .In("FApproveStatus", new List <string>()
                {
                    "2", "3"
                }))
                .Add(ORMRestrictions <Int32> .Eq("FLifeCycle", 0));;
                var mst = ProjectMstService.Find(dic2).Data;
                if (mst.Count > 0)
                {
                    return("false");
                }
                else
                {
                    return("true");
                }
            }
            else
            {
                return("true");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 同级增加获取代码
        /// </summary>
        /// <returns></returns>
        public string getCode()
        {
            string parentCode = System.Web.HttpContext.Current.Request.Params["parentCode"];
            string year       = System.Web.HttpContext.Current.Request.Params["year"];
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic).Add(ORMRestrictions <string> .Eq("DEFSTR2", parentCode));
            if (parentCode == "")
            {
                new CreateCriteria(dic).Add(ORMRestrictions <string> .LLike("DM", year));
            }
            List <ProjLibProjModel> ProjLibProjList = ProjLibProjService.Find(dic, new string[] { "DM Desc" }).Data.ToList().FindAll(x => !x.DM.Contains("."));

            if (ProjLibProjList.Count > 0)
            {
                var Top  = ProjLibProjList[0].DM.Substring(0, ProjLibProjList[0].DM.Length - 4);
                var End  = ProjLibProjList[0].DM.Substring(ProjLibProjList[0].DM.Length - 4);
                var End2 = "0000" + (Convert.ToInt64(End) + 1).ToString();
                return(Top + End2.Substring(End2.Length - 4));
            }
            else
            {
                if (parentCode == "")
                {
                    return(ProjectMstService.CreateOrGetMaxProjCode(year));
                }
                else
                {
                    return(parentCode + "0001");
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据支出类别(项目类型)的code判断是否是末级
        /// </summary>
        /// <returns>返回Json串</returns>
        public FindedResults <ExpenseCategoryModel> IfLastStage(string code)
        {
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <string> .NotEq("Dm", code))
            .Add(ORMRestrictions <string> .LLike("Dm", code));
            var findResult = base.Find(dicWhere);

            return(findResult);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 判断是否是末级
        /// </summary>
        /// <param name="kmdm"></param>
        /// <returns></returns>
        public Boolean JudgeIfEnd(string kmdm)
        {
            var dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).
            Add(ORMRestrictions <string> .LLike("KMDM", kmdm));
            if (BudgetAccountsFacade.Find(dicWhere).Data.Count > 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据组织获取该组织预算科目对应的初始预决算集合
        /// </summary>
        /// <param name="orgCode">组织Code</param>
        /// <param name="orgId">组织id</param>
        /// <param name="year">年份</param>
        /// <returns></returns>
        public List <YsAccountModel> GetYsAccountsBySubject(string orgCode, long orgId, string year)
        {
            List <YsAccountModel>       ysAccounts = new List <YsAccountModel>();
            Dictionary <string, object> dic        = new Dictionary <string, object>();

            //先获取预算所有的科目集合
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <long> .NotEq("PhId", (long)0));
            IList <BudgetAccountsModel> allAccounts = new List <BudgetAccountsModel>();

            allAccounts = this.BudgetAccountsRule.Find(dic);
            if (allAccounts == null || allAccounts.Count <= 0)
            {
                throw new Exception("预算科目数据为空!");
            }
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <string> .LLike("DefStr1", orgCode))
            .Add(ORMRestrictions <string> .Eq("Dylx", "02"));
            IList <CorrespondenceSettingsModel> allAccountsByOrg = new List <CorrespondenceSettingsModel>();

            allAccountsByOrg = this.CorrespondenceSettingsRule.Find(dic);
            if (allAccountsByOrg == null || allAccountsByOrg.Count <= 0)
            {
                throw new Exception("该组织及下级组织对应的预算科目数据为空!");
            }
            allAccountsByOrg = allAccountsByOrg.ToList().FindAll(t => (t.Dydm.StartsWith("4") || t.Dydm.StartsWith("5")));
            if (allAccountsByOrg != null && allAccountsByOrg.Count > 0)
            {
                foreach (var acc in allAccountsByOrg)
                {
                    YsAccountModel accountModel = new YsAccountModel();
                    accountModel.SUBJECTCODE = acc.Dydm;
                    accountModel.SUBJECTNAME = allAccounts.ToList().Find(t => t.KMDM == acc.Dydm) == null ? "" : allAccounts.ToList().Find(t => t.KMDM == acc.Dydm).KMMC;
                    accountModel.PHIDSUBJECT = allAccounts.ToList().Find(t => t.KMDM == acc.Dydm) == null ? 0 : allAccounts.ToList().Find(t => t.KMDM == acc.Dydm).PhId;
                    accountModel.ORGID       = orgId;
                    accountModel.ORGCODE     = orgCode;
                    accountModel.UYEAR       = year;
                    if (ysAccounts.FindAll(t => t.SUBJECTCODE == acc.Dydm).Count == 0)
                    {
                        ysAccounts.Add(accountModel);
                    }
                }

                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "4BNHJSR", SUBJECTNAME = "本年合计收入", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5BNHJZC", SUBJECTNAME = "本年合计支出", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM1", SUBJECTNAME = "本年结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM2", SUBJECTNAME = "加:上年结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM3", SUBJECTNAME = "加:本年收回投资", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM4", SUBJECTNAME = "减:本年投资", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM5", SUBJECTNAME = "减:本年提取后备金", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM6", SUBJECTNAME = "期末滚存结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts = ysAccounts.OrderBy(t => t.SUBJECTCODE).ToList();
            }
            return(ysAccounts);
        }