Пример #1
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");
            }
        }
        /// <summary>
        /// 根据项目代码获取对应归口部门
        /// </summary>
        /// <param name="Dwdm"></param>
        /// <returns></returns>
        public List <OrganizeModel> GetBMListDYGXdtl(string Dwdm)
        {
            List <OrganizeModel> result = new List <OrganizeModel>();
            var dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).
            Add(ORMRestrictions <string> .Eq("Dylx", "GKBM")).
            Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));

            IList <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Facade.Find(dicWhere, new string[] { "Dydm Asc" }).Data;

            if (correspondenceSettings2s.Count > 0)
            {
                var dicWhereOrg = new Dictionary <string, object>();
                new CreateCriteria(dicWhereOrg).
                Add(ORMRestrictions <string> .Eq("IfCorp", "N")).
                Add(ORMRestrictions <string> .Eq("IsActive", "1"));
                IList <OrganizeModel> OrgList = OrganizationFacade.Find(dicWhereOrg).Data;
                foreach (CorrespondenceSettings2Model a in correspondenceSettings2s)
                {
                    OrganizeModel b = new OrganizeModel();
                    b.PhId  = a.PhId;
                    b.OCode = a.Dydm;
                    b.OName = OrgList.ToList().Find(x => x.OCode == a.Dydm).OName;
                    result.Add(b);
                }
            }

            return(result);
        }
Пример #3
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);
        }
Пример #4
0
        /// <summary>
        /// 验证数据
        /// </summary>
        /// <returns></returns>
        public FindedResults <BudgetAccountsModel> ExecuteDataCheck(ref List <BudgetAccountsModel> budgetAccounts, string otype)
        {
            IList <string> kmdm = new List <string>();
            FindedResults <BudgetAccountsModel> results = new FindedResults <BudgetAccountsModel>();

            if (budgetAccounts == null)
            {
                results.Status = ResponseStatus.Error;
                results.Msg    = "保存失败,数据异常!";
            }
            else
            {
                for (int i = 0; i < budgetAccounts.Count; i++)
                {
                    budgetAccounts[i].KMDM = budgetAccounts[i].KMDM.Replace(" ", "");
                    budgetAccounts[i].KMMC = budgetAccounts[i].KMMC.Replace(" ", "");
                    budgetAccounts[i].KMLB = budgetAccounts[i].KMLB.Replace(" ", "");
                    kmdm.Add(budgetAccounts[i].KMDM);
                }
                var dicWhere = new Dictionary <string, object>();
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <IList <string> > .In("KMDM", kmdm));
                results = base.Find(dicWhere);
                if (results != null && results.Data.Count > 0 && otype != "edit")
                {
                    results.Status = ResponseStatus.Error;
                    results.Msg    = "保存失败,科目代码重复!";
                }
            }
            return(results);
        }
Пример #5
0
        /// <summary>
        /// 生成申请单编号
        /// </summary>
        /// <returns></returns>
        public string GetPaymentCode()
        {
            string paymentCode = "";
            string payment     = "";
            string code        = "";
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Ge("PhId", (long)0));
            var result = this.PaymentMstRule.Find(dic, new string[] { "FCode Desc" });

            if (result != null && result.Count > 0)
            {
                string fCode = result[0].FCode;
                if (fCode.Length == 12)
                {
                    payment = DateTime.Now.ToString("yyyyMMdd");
                    string fcode1 = fCode.Substring(0, 8);
                    if (payment.Equals(fcode1))
                    {
                        int fcode2 = int.Parse(fCode.Substring(8)) + 1;
                        if (fcode2 > 999 && fcode2 < 10000)
                        {
                            code = fcode2.ToString();
                        }
                        else if (fcode2 > 99 && fcode2 < 1000)
                        {
                            code = "0" + fcode2;
                        }
                        else if (fcode2 > 9 && fcode2 < 100)
                        {
                            code = "00" + fcode2;
                        }
                        else if (fcode2 > 0 && fcode2 < 10)
                        {
                            code = "000" + fcode2;
                        }
                        else
                        {
                            throw new Exception("申请单号生成失败!");
                        }
                    }
                    else
                    {
                        code = "0001";
                    }
                }
                else
                {
                    throw new Exception("申请单号为:" + fCode + "的申请编码生成错误,请联系管理员!");
                }
            }
            else
            {
                payment = DateTime.Now.ToString("yyyyMMdd");
                code    = "0001";
            }
            paymentCode = payment + code;
            return(paymentCode);
        }
Пример #6
0
        public string PostDelete([FromBody] InfoBaseModel <List <long> > phids)
        {
            var deletedresult = new DeletedResult();

            if (phids.infoData.Count > 0)
            {
                List <long> usePhids = BankAccountService.judgeIfUse(phids.infoData);
                if (usePhids.Count > 0)
                {
                    string Msg = "银行账户名称为";
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <List <long> > .In("PhId", usePhids));
                    IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data;
                    foreach (BankAccountModel bankAccount in bankAccounts)
                    {
                        Msg = Msg + bankAccount.FBankname + ",";
                    }
                    Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除";
                    deletedresult.Status = ResponseStatus.Error;
                    deletedresult.Msg    = Msg;
                }
                else
                {
                    for (var i = 0; i < phids.infoData.Count; i++)
                    {
                        deletedresult = BankAccountService.Delete <System.Int64>(phids.infoData[i]);
                        //BankAccountService.Find(t => phids.infoData.Contains(t.PhId));
                    }
                }
            }

            return(DataConverterHelper.SerializeObject(deletedresult));
        }
        public string GetProjectThresholdByOrgAndZCLB([FromUri] ProjectMstModel parameters)
        {
            if (string.IsNullOrEmpty(parameters.FDeclarationUnit))
            {
                return(DCHelper.ErrorMessage("组织编码为空!"));
            }
            if (string.IsNullOrEmpty(parameters.FExpenseCategory))
            {
                return(DCHelper.ErrorMessage("项目类型为空!"));
            }
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Orgcode", parameters.FDeclarationUnit));
            IList <ProjectThresholdModel> projectThresholds = ProjectThresholdService.Find(dicWhere).Data;

            if (projectThresholds.Count > 0)
            {
                foreach (var projectThreshold in projectThresholds)
                {
                    IList <String> useCodeList = (projectThreshold.ProjTypeId ?? "").Split(',').ToList <String>();
                    if (useCodeList.Contains(parameters.FExpenseCategory))
                    {
                        return(JsonConvert.SerializeObject(projectThreshold));
                    }
                }
            }
            return(JsonConvert.SerializeObject(new ProjectThresholdModel()));
        }
Пример #8
0
        /// <summary>
        /// 通过项目主键list获取已使用金钱与已冻结金钱的汇总
        /// </summary>
        /// <param name="xmPhidList">项目主键list</param>
        /// <returns></returns>
        public Dictionary <string, object> GetSummary2(List <long> xmPhidList)
        {
            Dictionary <string, object> keyValue = new Dictionary <string, object>();
            decimal sum1 = 0, sum2 = 0;

            foreach (long xmPhid in xmPhidList)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                new CreateCriteria(dic)
                .Add(ORMRestrictions <long> .Eq("XmMstPhid", xmPhid))
                .Add(ORMRestrictions <long> .NotEq("MstPhid", 0));
                var result = this.PaymentDtlRule.Find(dic);
                if (result.Count > 0)
                {
                    foreach (var paymentDtl in result)
                    {
                        if (paymentDtl.FPayment == 9)
                        {
                            sum1 = sum1 + paymentDtl.FAmount;
                        }
                        else
                        {
                            sum2 = sum2 + paymentDtl.FAmount;
                        }
                    }
                }
            }

            keyValue.Add("Use", sum1);
            keyValue.Add("Frozen", sum2);
            return(keyValue);
        }
Пример #9
0
        /// <summary>
        /// 保存时获取产品主键
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        public SavedResult <Int64> Save2(IList <QTProductUserModel> entities)
        {
            SavedResult <Int64> savedresult = new SavedResult <Int64>();

            try
            {
                for (var i = 0; i < entities.Count; i++)
                {
                    if (entities[i].ProductBZ != "")
                    {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        new CreateCriteria(dic).Add(ORMRestrictions <string> .Eq("ProductBZ", entities[i].ProductBZ));
                        QTProductModel qTProductModel = QTProductFacade.Find(dic).Data[0];
                        entities[i].ProductPhid = qTProductModel.PhId;
                    }
                }
                savedresult = base.Save <Int64>(entities, "");
            }
            catch (Exception ex)
            {
                savedresult.Status = ResponseStatus.Error;
                savedresult.Msg    = ex.Message.ToString();
            }
            return(savedresult);
        }
Пример #10
0
        /// <summary>
        /// 根据主键更新数据
        /// </summary>
        /// <param name="SetPhId"></param>
        /// <returns></returns>
        public SavedResult <long> UpdateOrg(string SetPhId)
        {
            string ControlOrgName = "";
            var    result         = new SavedResult <long>();
            var    dicWhere       = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).
            Add(ORMRestrictions <string> .Eq("Dylx", "button")).
            Add(ORMRestrictions <string> .Eq("Dwdm", SetPhId));
            IList <CorrespondenceSettings2Model> correspondenceSettings2 = CorrespondenceSettings2Facade.Find(dicWhere).Data;

            if (correspondenceSettings2.Count > 0)
            {
                for (var i = 0; i < correspondenceSettings2.Count; i++)
                {
                    ControlOrgName = ControlOrgName + correspondenceSettings2[i].DefStr2 + ";";
                }
            }
            QTControlSetModel qTControlSet = base.Find(long.Parse(SetPhId)).Data;

            qTControlSet.ControlOrgName  = ControlOrgName;
            qTControlSet.PersistentState = PersistentState.Modified;
            result = base.Save <long>(qTControlSet, "");
            return(result);
        }
Пример #11
0
        /// <summary>
        /// 根据组织取对应关系列表基础数据详细(得到的PhId为对应关系的主键)(没有对应关系的数据)
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetBudgetAccountsListNoDYGXdtl()
        {
            string        Dwdm = System.Web.HttpContext.Current.Request.Params["Dwdm"];//查询条件
            List <string> list = new List <string>();
            Dictionary <string, object> dicWhere  = new Dictionary <string, object>();
            Dictionary <string, object> dicWhere2 = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "02"));
            if (Dwdm != null)
            {
                new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));
            }

            var result = BudgetAccountsService.ServiceHelper.LoadWithPageInfinity("GQT.QT.DYGX-YSKM", dicWhere);

            for (var i = 0; i < result.TotalItems; i++)
            {
                list.Add(result.Results[i].KMDM);
            }
            if (list.Count > 0)
            {
                new CreateCriteria(dicWhere2).Add(ORMRestrictions <List <string> > .NotIn("KMDM", list));
            }
            var result2 = BudgetAccountsService.ServiceHelper.LoadWithPageInfinity("GQT.QT.YSKMAll", dicWhere2);

            return(DataConverterHelper.EntityListToJson <BudgetAccountsModel>(result2.Results, (Int32)result2.TotalItems));
        }
Пример #12
0
        /// <summary>
        /// 导出数据
        /// </summary>
        /// <returns></returns>
        public void ExportData()
        {
            //string ProductBZ = System.Web.HttpContext.Current.Request.Params["ProductBZ"];
            HSSFWorkbook book  = new NPOI.HSSF.UserModel.HSSFWorkbook();
            ISheet       sheet = book.CreateSheet("sheet1");
            IRow         row1  = sheet.CreateRow(0);

            row1.CreateCell(0).SetCellValue("代码");
            row1.CreateCell(1).SetCellValue("名称");
            //row1.CreateCell(2).SetCellValue("备注");

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <System.Int64> .NotEq("PhId", 0));
            IList <ProcurementCatalogModel> procurementCatalogs = ProcurementCatalogService.Find(dicWhere).Data;

            for (int i = 0; i < procurementCatalogs.Count; i++)
            {
                ProcurementCatalogModel model = procurementCatalogs[i];
                IRow row = sheet.CreateRow(i + 1);
                row.CreateCell(0).SetCellValue(model.FCode);
                row.CreateCell(1).SetCellValue(model.FName);
                //row.CreateCell(2).SetCellValue(model.FRemark);
            }
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            book.Write(ms);
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff")));
            Response.BinaryWrite(ms.ToArray());
            book = null;
            ms.Close();
            ms.Dispose();
        }
Пример #13
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public string Save2()
        {
            string Orgcode = System.Web.HttpContext.Current.Request.Params["Orgcode"];
            string data    = System.Web.HttpContext.Current.Request.Params["data"];

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Orgcode", Orgcode));
            IList <ProjectThresholdModel> projectThresholdModels = ProjectThresholdService.Find(dicWhere).Data;
            List <long> phidList = projectThresholdModels.ToList().Select(x => x.PhId).ToList();
            List <ProjectThresholdModel> SaveData = new List <ProjectThresholdModel>();

            if (data.EndsWith("|"))
            {
                data = data.Substring(0, data.Length - 1);
            }
            String[] Items = data.Split('|');
            foreach (String item in Items)
            {
                //取到item,即序列化对象
                String[] attrs = item.Split(':');
                if (string.IsNullOrEmpty(attrs[0]) || attrs[0] == "0")
                {
                    var p1 = new ProjectThresholdModel();
                    p1.Orgcode         = attrs[1];
                    p1.FThreshold      = attrs[2];
                    p1.ProjTypeId      = attrs[3];
                    p1.ProjTypeName    = attrs[4];
                    p1.Orgid           = long.Parse(attrs[5]);
                    p1.PersistentState = PersistentState.Added;
                    SaveData.Add(p1);
                }
                else
                {
                    if (phidList.Contains(long.Parse(attrs[0])))
                    {
                        phidList.Remove(long.Parse(attrs[0]));
                    }
                    var p1 = projectThresholdModels.ToList().Find(x => x.PhId == long.Parse(attrs[0]));
                    p1.FThreshold      = attrs[2];
                    p1.ProjTypeId      = attrs[3];
                    p1.ProjTypeName    = attrs[4];
                    p1.PersistentState = PersistentState.Modified;
                    SaveData.Add(p1);
                }
            }
            if (phidList.Count > 0)
            {
                foreach (var phid in phidList)
                {
                    var p1 = projectThresholdModels.ToList().Find(x => x.PhId == phid);
                    p1.PersistentState = PersistentState.Deleted;
                    SaveData.Add(p1);
                }
            }

            SavedResult <Int64> savedresult = ProjectThresholdService.Save <Int64>(SaveData, "");

            return(DataConverterHelper.SerializeObject(savedresult));
        }
Пример #14
0
        public ActionResult SaveOrUpdate(String data)
        {
            DataStoreParam dataStoreParam = this.GetDataStoreParam();
            var            result         = CorrespondenceSettingsService.LoadWithPageOrg(dataStoreParam);
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic("");
            IList <OrganizeModel> organizes = result.Results as List <OrganizeModel>;

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <Int64> .NotEq("PhId", 0));
            IList <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.Find(dicWhere).Data as List <CorrespondenceSettings2Model>;

            //IList<CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Service.LoadWithPage(dataStoreParam.PageIndex, dataStoreParam.PageSize, dicWhere).Results as List<CorrespondenceSettings2Model>;
            organizes = ProjectThresholdService.GetSBOrganizes(organizes, correspondenceSettings2s);
            //IList<ProjectThresholdModel> projectThresholds = (ProjectThresholdService.LoadWithPage(dataStoreParam.PageIndex, dataStoreParam.PageSize, dicWhere)).Results as List<ProjectThresholdModel>;
            IList <ProjectThresholdModel> projectThresholds = ProjectThresholdService.Find(dicWhere).Data as List <ProjectThresholdModel>;

            if (this.ProjectThresholdService.SaveOrUpdate(data, organizes, projectThresholds, dataStoreParam))
            {
                return(Content("{\"result\":\"success\"}"));
            }
            else
            {
                return(Content("{\"result\":\"fail\"}"));
            }
        }
        /// <summary>
        /// 根据申报部门获取设置过对应关系的项目+项目的预算部门为该申报部门的项目
        /// </summary>
        /// <returns></returns>
        public string GetXMbySBDept()
        {
            string Dept = System.Web.HttpContext.Current.Request.Params["Dept"];
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "GKBM"))
            .Add(ORMRestrictions <string> .Eq("Dydm", Dept));
            List <string> ProjcodeList              = CorrespondenceSettings2Service.Find(dicWhere).Data.ToList().Select(x => x.Dwdm).Distinct().ToList();
            Dictionary <string, object> dicWhereys  = new Dictionary <string, object>();
            Dictionary <string, object> dicWhereys1 = new Dictionary <string, object>();
            Dictionary <string, object> dicWhereys2 = new Dictionary <string, object>();
            Dictionary <string, object> dicWhereys3 = new Dictionary <string, object>();

            new CreateCriteria(dicWhereys1).Add(ORMRestrictions <List <string> > .In("FProjCode", ProjcodeList));
            new CreateCriteria(dicWhereys2).Add(ORMRestrictions <string> .Eq("FYear", DateTime.Now.Year.ToString()))
            .Add(ORMRestrictions <string> .Eq("FBudgetDept", Dept))
            .Add(ORMRestrictions <System.Int32> .Eq("FLifeCycle", 0))
            .Add(ORMRestrictions <System.String> .Eq("FApproveStatus", "3"))
            .Add(ORMRestrictions <String> .Eq("FMidYearChange", "0"));
            new CreateCriteria(dicWhereys3).Add(ORMRestrictions <string> .Eq("FYear", DateTime.Now.Year.ToString()))
            .Add(ORMRestrictions <string> .Eq("FDeclarationDept", Dept))
            .Add(ORMRestrictions <System.Int32> .Eq("FLifeCycle", 0))
            .Add(ORMRestrictions <System.String> .Eq("FApproveStatus", "3"))
            .Add(ORMRestrictions <String> .Eq("FMidYearChange", "0"));
            new CreateCriteria(dicWhereys).Add(ORMRestrictions.Or(dicWhereys1, dicWhereys2, dicWhereys3));
            string[] Array  = BudgetMstService.Find(dicWhereys).Data.ToList().Select(x => x.FProjCode).Distinct().ToArray();
            var      result = JsonConvert.SerializeObject(Array);

            return(result);
        }
Пример #16
0
        /// <summary>
        /// 通过外键值获取PerformanceDtlTarImpl明细数据
        /// </summary>
        /// <param name="id">外键值</param>
        /// <returns></returns>
        public FindedResults <PerformanceDtlTarImplModel> FindPerformanceDtlTarImplByForeignKey <TValType>(TValType id)
        {
            FindedResults <PerformanceDtlTarImplModel> results = PerformanceDtlTarImplFacade.FindByForeignKey(id);

            if (results != null)
            {
                var data = results.Data;
                for (int i = 0; i < data.Count; i++)
                {
                    PerformanceDtlTarImplModel model = data[i];
                    string typeCode  = model.FTargetTypeCode;
                    string classCode = model.FTargetClassCode;
                    Dictionary <string, object> dicWhere1 = new Dictionary <string, object>();
                    Dictionary <string, object> dicWhere2 = new Dictionary <string, object>();
                    new CreateCriteria(dicWhere1).Add(ORMRestrictions <string> .Eq("FCode", typeCode));
                    FindedResults <PerformEvalTargetTypeModel> typeModel = PerformEvalTargetTypeFacade.Find(dicWhere1);
                    new CreateCriteria(dicWhere2).Add(ORMRestrictions <string> .Eq("FCode", classCode));
                    FindedResults <PerformEvalTargetClassModel> classModel = PerformEvalTargetClassFacade.Find(dicWhere2);
                    if (typeModel != null && typeModel.Data.Count > 0)
                    {
                        model.FTargetTypeCode = typeModel.Data[0].FName;
                    }
                    if (classModel != null && classModel.Data.Count > 0)
                    {
                        model.FTargetClassCode = classModel.Data[0].FName;
                    }
                }
            }
            return(results);
        }
        /// <summary>
        /// 保存用户设置的当前年度
        /// </summary>
        /// <returns></returns>
        public string SaveUserYear()
        {
            string UserCode = System.Web.HttpContext.Current.Request.Params["UserCode"];
            string FYear    = System.Web.HttpContext.Current.Request.Params["FYear"];


            var dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "YEAR"))
            .Add(ORMRestrictions <string> .Eq("Dwdm", UserCode));
            var Model2 = CorrespondenceSettings2Service.Find(dicWhere).Data;

            if (Model2.Count > 0)
            {
                Model2[0].Dydm            = FYear;
                Model2[0].PersistentState = PersistentState.Modified;
                var result = CorrespondenceSettings2Service.Save <Int64>(Model2[0], "");
                return(DataConverterHelper.SerializeObject(result));
            }
            else
            {
                CorrespondenceSettings2Model model = new CorrespondenceSettings2Model();
                model.Dydm            = FYear;
                model.Dylx            = "YEAR";
                model.Dwdm            = UserCode;
                model.PersistentState = PersistentState.Added;
                var result = CorrespondenceSettings2Service.Save <Int64>(model, "");
                return(DataConverterHelper.SerializeObject(result));
            }
        }
Пример #18
0
        ///// <summary>
        ///// 方法实例
        ///// </summary>
        ///// <returns></returns>
        //public IList<CorrespondenceSettingsModel> ExampleMethod<CorrespondenceSettingsModel>(string param)
        //{
        //    //编写代码
        //}

        /// <summary>
        /// 根据当前usercode 获取所拥有部门信息
        /// </summary>
        /// <param name="usercode"></param>
        /// <returns></returns>
        public List <CorrespondenceSettingsModel> GetUserDepementList(string usercode)
        {
            var dic = new Dictionary <string, object>();

            new CreateCriteria(dic).Add(ORMRestrictions <string> .Eq("Dylx", "97"))
            .Add(ORMRestrictions <string> .Eq("Dwdm", usercode));


            #region 取最大的200,循环取LastPage
            List <CorrespondenceSettingsModel> Result = new List <CorrespondenceSettingsModel>();
            int pagesize  = 100;
            int pageindex = 0;
            //去第一次200的数据
            var resultt = base.FacadeHelper.LoadWithPage(pageindex, pagesize, dic);

            long total = resultt.TotalItems;
            //IList<CorrespondenceSettingsModel> list1 = resultt.Results;
            Result.AddRange(resultt.Results.ToList());


            while (total > (pageindex + 1) * pagesize)
            {
                pageindex++;
                var resulttemp = base.FacadeHelper.LoadWithPage(pageindex, pagesize, dic);
                Result.AddRange(resulttemp.Results);
            }
            #endregion

            return(Result);
        }
Пример #19
0
        public string GetBankAccountareaList([FromUri] long OrgPhid, [FromUri] string selectStr)
        {
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <Int64> .Eq("OrgPhid", OrgPhid));

            var           data = BankAccountService.Find(dicWhere).Data.ToList();
            List <string> list = null;

            if (data.Count > 0 && !string.IsNullOrEmpty(selectStr))
            {
                data = data.FindAll(t => t.FAccount.IndexOf(selectStr) > -1 || t.FBankname.IndexOf(selectStr) > -1);
                var dataresult = data.Select(m => m.BankName);
                list = dataresult.Distinct().ToList();
                //string[] area = (data.Select(m => m.BankName).ToString()).Split(',');
                //List<string> list = new List<string>();
                //foreach (var item in area)
                //{
                //    if (!list.Contains(item))
                //    {
                //        list.Add(item);
                //    }
                //}
            }
            if (list.Count > 0)
            {
                return(DCHelper.ModelListToJson <string>(list, list.Count));
            }
            else
            {
                return(DCHelper.ModelListToJson <string>(list, 0));
            }
        }
Пример #20
0
        /// <summary>
        /// 根据BZ获取数据(只取控制的)
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetQTControlByBZ()
        {
            string BZ = System.Web.HttpContext.Current.Request.Params["BZ"];
            SavedResult <Int64>         savedresult = new SavedResult <Int64>();
            Dictionary <string, object> dicWhereSet = new Dictionary <string, object>();

            new CreateCriteria(dicWhereSet)
            .Add(ORMRestrictions <string> .Eq("BZ", BZ))
            .Add(ORMRestrictions <string> .Eq("ControlOrNot", "1"));
            IList <QTControlSetModel> SetResult = QTControlSetService.Find(dicWhereSet).Data;


            if (SetResult.Count > 0)
            {
                savedresult.Msg = "true";
            }
            else
            {
                savedresult.Msg = "false";
            }

            savedresult.Status = ResponseStatus.Success;

            return(DataConverterHelper.SerializeObject(savedresult));
        }
Пример #21
0
        /// <summary>
        /// 验证数据
        /// </summary>
        /// <returns></returns>
        public FindedResults <PerformEvalTargetTypeModel> ExecuteDataCheck(ref List <PerformEvalTargetTypeModel> performEvalTargetType, string otype)
        {
            IList <string> dm = new List <string>();
            FindedResults <PerformEvalTargetTypeModel> results = new FindedResults <PerformEvalTargetTypeModel>();

            if (performEvalTargetType == null)
            {
                results.Status = ResponseStatus.Error;
                results.Msg    = "保存失败,数据异常!";
            }
            else
            {
                for (int i = 0; i < performEvalTargetType.Count; i++)
                {
                    performEvalTargetType[i].FCode = performEvalTargetType[i].FCode.Replace(" ", "");
                    performEvalTargetType[i].FName = performEvalTargetType[i].FName.Replace(" ", "");
                    performEvalTargetType[i].FRemark.Trim();
                    dm.Add(performEvalTargetType[i].FCode);
                }
                var dicWhere1 = new Dictionary <string, object>();
                new CreateCriteria(dicWhere1).
                Add(ORMRestrictions <IList <string> > .In("FCode", dm));

                if (base.Find(dicWhere1) != null && base.Find(dicWhere1).Data.Count > 0 && otype != "edit")
                {
                    results        = base.Find(dicWhere1);
                    results.Status = ResponseStatus.Error;
                    results.Msg    = "保存失败,代码重复!";
                }
            }
            return(results);
        }
        /// <summary>
        /// 取对应关系列表数据
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetCorrespondenceSettingsListbyRelation(string Dylx, string Dwdm, string DefStr1)
        {
            //string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];//查询条件
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery);//查询条件转Dictionary
            var dicWhere = new Dictionary <string, object>();

            if (Dylx != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("Dylx", Dylx));
            }
            if (Dwdm != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));
            }
            if (DefStr1 != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("DefStr1", DefStr1));
            }
            DataStoreParam storeparam = this.GetDataStoreParam();
            //var result = CorrespondenceSettingsService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere);
            //var result = CorrespondenceSettingsService.LoadWithPage(storeparam.PageIndex, 100, dicWhere);
            var result = CorrespondenceSettingsService.ServiceHelper.LoadWithPageInfinity("GQT3.QT.DYGX_All", dicWhere);

            return(DataConverterHelper.EntityListToJson <CorrespondenceSettingsModel>(result.Results, (Int32)result.TotalItems));
        }
Пример #23
0
        /// <summary>
        /// 根据项目代码获取额度核销总金额
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public decimal GetHXsumByCode(string code)
        {
            decimal sum      = 0;
            var     dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("FProjcode", code))
            .Add(ORMRestrictions <System.Int32> .Eq("FLifeCycle", 0))
            .Add(ORMRestrictions <System.Int32> .NotEq("FIfpurchase", 1));
            IList <ExpenseMstModel> ExpenseMstList = ExpenseMstFacade.Find(dicWhere).Data;

            if (ExpenseMstList.Count > 0)
            {
                for (var i = 0; i < ExpenseMstList.Count; i++)
                {
                    if (ExpenseMstList[i].FIfKeyEvaluation == 1)
                    {
                        var dicWhere2 = new Dictionary <string, object>();
                        new CreateCriteria(dicWhere2).Add(ORMRestrictions <Int64> .Eq("MstPhid", ExpenseMstList[i].PhId));
                        IList <ExpenseHxModel> ExpenseHxList = ExpenseHxFacade.Find(dicWhere2).Data;
                        if (ExpenseHxList.Count > 0)
                        {
                            for (var j = 0; j < ExpenseHxList.Count; j++)
                            {
                                sum += ExpenseHxList[j].FAmount;
                            }
                        }
                    }
                }
            }
            return(sum);
        }
Пример #24
0
        /// <summary>
        /// 根据组织取对应关系列表基础数据详细(得到的PhId为对应关系的主键)(没有对应关系的数据)
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetExpenseCategoryListNoDYGXdtl()
        {
            string        Dwdm = System.Web.HttpContext.Current.Request.Params["Dwdm"];//查询条件
            List <string> list = new List <string>();
            Dictionary <string, object> dicWhere  = new Dictionary <string, object>();
            Dictionary <string, object> dicWhere2 = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "08"));
            if (Dwdm != null)
            {
                new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));
            }

            var result = ExpenseCategoryService.ServiceHelper.LoadWithPageInfinity("GQT.QT.DYGX2-ZCLB", dicWhere);

            for (var i = 0; i < result.TotalItems; i++)
            {
                list.Add(result.Results[i].Dm);
            }
            if (list.Count > 0)
            {
                new CreateCriteria(dicWhere2).Add(ORMRestrictions <List <string> > .NotIn("Dm", list));
            }
            var result2 = ExpenseCategoryService.ServiceHelper.LoadWithPageInfinity("GQT.QT.ZCLBALL", dicWhere2, false, new string[] { "Dm Asc" });

            return(DataConverterHelper.EntityListToJson <ExpenseCategoryModel>(result2.Results, (Int32)result2.TotalItems));
        }
        /// <summary>
        /// 根据按钮主键取对应关系列表基础数据详细(得到的PhId为对应关系的主键)(没有对应关系的数据)(按钮权限)
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetOrgListNoDYGXdtl(string Dwdm)
        {
            List <string> list = new List <string>();
            Dictionary <string, object> dicWhere  = new Dictionary <string, object>();
            Dictionary <string, object> dicWhere2 = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("Dylx", "button"))
            .Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));
            var result = CorrespondenceSettings2Facade.FacadeHelper.LoadWithPageInfinity("GQT3.QT.DYGX2_All", dicWhere);

            new CreateCriteria(dicWhere2).Add(ORMRestrictions <string> .Eq("IfCorp", "Y"))
            .Add(ORMRestrictions <string> .Eq("IsActive", "1"));
            for (var i = 0; i < result.TotalItems; i++)
            {
                list.Add(result.Results[i].Dydm);
            }
            if (list.Count > 0)
            {
                new CreateCriteria(dicWhere2)
                .Add(ORMRestrictions <List <string> > .NotIn("OCode", list));
            }
            var result2 = OrganizationFacade.FacadeHelper.LoadWithPageInfinity("GQT.QT.GetOrganize", dicWhere2, false, new string[] { "OCode Asc" });

            return(DataConverterHelper.EntityListToJson <OrganizeModel>(result2.Results, (Int32)result2.TotalItems));
        }
Пример #26
0
        /// <summary>
        /// 导出数据
        /// </summary>
        /// <returns></returns>
        public void ExportData()
        {
            string       ProductBZ = System.Web.HttpContext.Current.Request.Params["ProductBZ"];
            HSSFWorkbook book      = new NPOI.HSSF.UserModel.HSSFWorkbook();
            ISheet       sheet     = book.CreateSheet("sheet1");
            IRow         row1      = sheet.CreateRow(0);

            row1.CreateCell(0).SetCellValue("账号");
            row1.CreateCell(1).SetCellValue("密码");
            row1.CreateCell(2).SetCellValue("姓名");

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("ProductBZ", ProductBZ));
            IList <QTProductUserModel> qTProductUsers = QTProductUserService.ServiceHelper.LoadWithPageInfinity("GQT.QT.ALLProductUsers", dicWhere).Results;

            //List<BudgetAccountsModel> models = budgetAccounts.ToList();
            for (int i = 0; i < qTProductUsers.Count; i++)
            {
                QTProductUserModel model = qTProductUsers[i];
                IRow row = sheet.CreateRow(i + 1);
                row.CreateCell(0).SetCellValue(model.ProductUserCode);
                row.CreateCell(1).SetCellValue(model.ProductUserPwd);
                row.CreateCell(2).SetCellValue(model.ProductUserName);
            }
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            book.Write(ms);
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff")));
            Response.BinaryWrite(ms.ToArray());
            book = null;
            ms.Close();
            ms.Dispose();
        }
        /// <summary>
        /// 根据项目代码获取对应归口部门(没有对应关系的)
        /// </summary>
        /// <param name="Dwdm"></param>
        /// <param name="OrgId"></param>
        /// <returns></returns>
        public IList <OrganizeModel> GetBMListNoDYGXdtl(string Dwdm, string OrgId)
        {
            //取出设置了对应关系的部门
            var dicWhereDYGX = new Dictionary <string, object>();

            new CreateCriteria(dicWhereDYGX).
            Add(ORMRestrictions <string> .Eq("Dylx", "GKBM")).
            Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));

            IList <CorrespondenceSettings2Model> correspondenceSettings2s = CorrespondenceSettings2Facade.Find(dicWhereDYGX).Data;
            List <string> OrgDYGX = correspondenceSettings2s.ToList().Select(x => x.Dydm).Distinct().ToList();

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Eq("IfCorp", "N"))
            .Add(ORMRestrictions <string> .Eq("IsActive", "1"))
            .Add(ORMRestrictions <List <string> > .NotIn("OCode", OrgDYGX));
            if (!string.IsNullOrEmpty(OrgId))
            {
                new CreateCriteria(dicWhere).Add(ORMRestrictions <Int64> .Eq("ParentOrgId", long.Parse(OrgId)));
            }
            var result = OrganizationFacade.Find(dicWhere, new string[] { "OCode" }).Data;

            if (result.Count > 0)
            {
                foreach (var a in result)
                {
                    a.PhId = 0;
                }
            }
            return(result);
        }
        /// <summary>
        /// 取对应关系列表数据
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetCorrespondenceSettings2ListbyRelation(string Dylx, string Dwdm, string DefStr1)
        {
            var dicWhere = new Dictionary <string, object>();

            if (Dylx != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("Dylx", Dylx));
            }
            if (Dwdm != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("Dwdm", Dwdm));
            }
            if (DefStr1 != null)
            {
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("DefStr1", DefStr1));
            }

            DataStoreParam storeparam = this.GetDataStoreParam();
            //var result = CorrespondenceSettings2Service.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere);
            var result = CorrespondenceSettings2Service.ServiceHelper.LoadWithPageInfinity("GQT3.QT.DYGX2_All", dicWhere);

            return(DataConverterHelper.EntityListToJson <CorrespondenceSettings2Model>(result.Results, (Int32)result.TotalItems));
        }
Пример #29
0
        /// <summary>
        /// 得到子级
        /// </summary>
        /// <param name="orgTree"></param>
        /// <param name="OrgPhids"></param>
        /// <returns></returns>
        public List <OrganizeModel> GetChild(OrganizeModel orgTree, List <Int64> OrgPhids)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic)
            .Add(ORMRestrictions <String> .Eq("RelatId", "lg"))
            .Add(ORMRestrictions <Int64> .Eq("ParentOrgId", orgTree.PhId));
            IList <OrgRelatitem2Model> orgRelatitems = OrgRelatitem2Rule.Find(dic, new string[] { "RelId Asc" });

            if (orgRelatitems.Count > 0)
            {
                for (var i = 0; i < orgRelatitems.Count; i++)
                {
                    OrganizeModel Orgdata = OrganizationRule.Find(orgRelatitems[i].OrgId);
                    if (Orgdata.IfCorp == "Y" && Orgdata.IsActive == "1")//筛选组织
                    {
                        if (!OrgPhids.Contains(Orgdata.PhId))
                        {
                            Orgdata.WeChatId = "false";//用于判断是否没有权限
                        }
                        Orgdata.children = GetChild(Orgdata, OrgPhids);


                        if (orgTree.children == null)
                        {
                            orgTree.children = new List <OrganizeModel>();
                        }
                        orgTree.children.Add(Orgdata);
                    }
                }
            }
            return(orgTree.children);
        }
Пример #30
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");
                }
            }
        }