Ejemplo n.º 1
0
        public bool Update(User2Model model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "user_update",
                                                                              "@user_id", model.user_id,
                                                                              "@hoten", model.hoten,
                                                                              "@ngaysinh", model.ngaysinh,
                                                                              "@diachi", model.diachi,
                                                                              "@gioitinh", model.gioitinh,
                                                                              "@email", model.email,
                                                                              "@taikhoan", model.taikhoan,
                                                                              "@matkhau", model.matkhau,
                                                                              "@role", model.role,
                                                                              "@image_url", model.image_url);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据流程id获取整个流程的岗位人员
        /// </summary>
        /// <param name="refbillPhid">单据主键</param>
        /// <param name="procPhid">流程id</param>
        /// <returns></returns>
        public List <GAppvalPostModel> GetBackApprovalPost2(long refbillPhid, long procPhid)
        {
            List <GAppvalPostModel> postModels = new List <GAppvalPostModel>();

            postModels.Add(new GAppvalPostModel
            {
                PhId  = 0,
                FName = "发起人"
            });

            //当前审批流程的所有审批岗位
            List <GAppvalPostModel> allPosts = GAppvalPostFacade.FindAppvalPostByProcID(procPhid).OrderBy(t => t.Seq).ToList();

            postModels.AddRange(allPosts);

            foreach (GAppvalPostModel postModel in postModels)
            {
                if (postModel.PhId == 0)
                {
                    if (refbillPhid == 0)
                    {
                        postModel.Operators = null;
                    }
                    else
                    {
                        try
                        {
                            List <GAppvalPost4OperModel> operModels = new List <GAppvalPost4OperModel>();
                            GAppvalRecordModel           model      = GAppvalRecordFacade.Find(t => t.RefbillPhid == refbillPhid && t.PostPhid == 0 && t.FBilltype == BillType.BeginProject).Data.ToList().OrderByDescending(t => t.FSendDate).ToList()[0];
                            User2Model user = UserFacade.Find(model.OperaPhid).Data;
                            operModels.Add(new GAppvalPost4OperModel
                            {
                                PostPhid     = 0,
                                OperatorPhid = user.PhId,
                                OperatorName = user.UserName
                            });
                            postModel.Operators = operModels;
                        }
                        catch (Exception e)
                        {
                            throw new Exception("查询发起人失败!");
                        }
                    }
                }
                else
                {
                    try
                    {
                        postModel.Operators = GAppvalPost4OperFacade.GetOperatorsByPostID(postModel.PhId);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("根据岗位id查找操作失败!");
                    }
                }
            }
            return(postModels);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 根据id获取用户
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public User2Model GetUser(long userid)
 {
     if (userid != 0)
     {
         User2Model user = UserFacade.Find(userid).Data;
         return(user);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public string GetAllReportExcel([FromUri] BaseListModel param)
        {
            if (param.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id不能为空!"));
            }
            if (param.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id不能为空!"));
            }
            if (string.IsNullOrEmpty(param.orgCode))
            {
                return(DCHelper.ErrorMessage("组织编码不能为空!"));
            }
            if (string.IsNullOrEmpty(param.Year))
            {
                return(DCHelper.ErrorMessage("年份参数不能为空!"));
            }
            try
            {
                string            result       = "";
                YsAccountMstModel ysAccountMst = new YsAccountMstModel();
                ysAccountMst = this.YsAccountMstService.GetAllYsAccountList(param.orgid, param.orgCode, param.Year, param.ChooseOwn, param.value);
                if (ysAccountMst.YsAccounts != null && ysAccountMst.YsAccounts.Count > 0)
                {
                    //获取组织和用户信息
                    User2Model    userModel     = new User2Model();
                    OrganizeModel organizeModel = new OrganizeModel();
                    userModel     = this.BudgetMstService.GetUser(param.uid);
                    organizeModel = this.BudgetMstService.GetOrganize(param.orgid);


                    if (param.value == "1")
                    {
                        result = this.YsAccountMstService.GetBeginExcel(ysAccountMst.YsAccounts.ToArray(), null, userModel, organizeModel);
                    }
                    else if (param.value == "2")
                    {
                        result = this.YsAccountMstService.GetMiddleExcel(ysAccountMst.YsAccounts.ToArray(), null, userModel, organizeModel);
                    }
                    else if (param.value == "3")
                    {
                        result = this.YsAccountMstService.GetEndExcel(ysAccountMst.YsAccounts.ToArray(), null, userModel, organizeModel);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
 public User2Model UpdateUser([FromBody] User2Model model)
 {
     if (model.image_url != null)
     {
         var arrData = model.image_url.Split(';');
         if (arrData.Length == 3)
         {
             var savePath = $@"assets/images/{arrData[0]}";
             model.image_url = $"{savePath}";
             SaveFileFromBase64String(savePath, arrData[2]);
         }
     }
     _userBusiness.Create(model);
     return(model);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 不删除设置对应关系
        /// </summary>
        /// <param name="ProductBZ"></param>
        /// <returns></returns>
        public CommonResult SaveByProductNoDelete(string ProductBZ)
        {
            CommonResult result = new CommonResult();

            try
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                new CreateCriteria(dic).Add(ORMRestrictions <EnumUserStatus> .Eq("Status", EnumUserStatus.Activate));
                //var Users = UserFacade.FacadeHelper.LoadWithPageInfinity("GQT.QT.GetAllUsers", dic2);
                var Users = UserFacade.Find(dic).Data;
                for (var i = 0; i < Users.Count; i++)
                {
                    User2Model user = Users[i];
                    Dictionary <string, object> dic2 = new Dictionary <string, object>();
                    new CreateCriteria(dic2).Add(ORMRestrictions <string> .Eq("ProductBZ", ProductBZ))
                    .Add(ORMRestrictions <string> .Eq("Fg3userno", user.UserNo));
                    var IfDYGX = base.Find(dic2).Data;
                    Dictionary <string, object> dic3 = new Dictionary <string, object>();
                    new CreateCriteria(dic3).Add(ORMRestrictions <string> .Eq("ProductBZ", ProductBZ))
                    .Add(ORMRestrictions <string> .Eq("ProductUserCode", user.UserNo));
                    var IfUser = QTProductUserFacade.Find(dic3).Data;
                    if (IfDYGX.Count == 0 && IfUser.Count > 0)
                    {
                        QTProductUserModel     qTProductUserModel     = IfUser[0];
                        QTProductUserDygxModel qTProductUserDygxModel = new QTProductUserDygxModel
                        {
                            ProductBZ       = ProductBZ,
                            ProductUserCode = user.UserNo,
                            ProductPhid     = qTProductUserModel.ProductPhid,
                            ProductUserPhid = qTProductUserModel.PhId,
                            ProductUserName = qTProductUserModel.ProductUserName,
                            ProductUserPwd  = qTProductUserModel.ProductUserPwd,
                            Fg3userPhid     = user.PhId,
                            Fg3userno       = user.UserNo,
                            Fg3username     = user.UserName,
                            PersistentState = PersistentState.Added
                        };
                        base.Save <Int64>(qTProductUserDygxModel, "");
                    }
                }
            }
            catch (Exception e)
            {
                result.Status = ResponseStatus.Error;
                result.Msg    = "同步失败!";
            }
            return(result);
        }
Ejemplo n.º 7
0
        public string PostExportMiddleYear([FromBody] BaseInfoModel <YsAccountMstModel> param)
        {
            if (param.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id不能为空!"));
            }
            if (param.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id不能为空!"));
            }
            if (param.infoData == null)
            {
                return(DCHelper.ErrorMessage("参数传递有误!"));
            }
            try
            {
                if (param.infoData.YsAccounts != null && param.infoData.YsAccounts.Count > 0)
                {
                    IList <YsAccountModel> ysAccounts = new List <YsAccountModel>();
                    foreach (var acc in param.infoData.YsAccounts)
                    {
                        ysAccounts.Add(acc);
                        GetYsAccountsChilds(acc, ysAccounts);
                    }
                    param.infoData.YsAccounts = ysAccounts;
                }
                else
                {
                    return(DCHelper.ErrorMessage("导出参数传递有误!"));
                }
                //获取组织和用户信息
                User2Model    userModel     = new User2Model();
                OrganizeModel organizeModel = new OrganizeModel();
                userModel     = this.BudgetMstService.GetUser(param.uid);
                organizeModel = this.BudgetMstService.GetOrganize(param.orgid);

                //string result = "";
                // ysAccountMst = new YsAccountMstModel();
                //ysAccountMst = this.YsAccountMstService.GetMiddleAccounts(488181024000002,"101", "2019");
                string result = this.YsAccountMstService.GetMiddleExcel(param.infoData.YsAccounts.ToArray(), null, userModel, organizeModel);
                return(result);
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
Ejemplo n.º 8
0
        public IEnumerable <User2Model> Get(int level)
        {
            var model = new List <User2Model>();

            using (OdbcConnection conn = new OdbcConnection(connectionString))
            {
                OdbcCommand cmd = new OdbcCommand(connectionString);
                cmd.Connection = conn;

                try
                {
                    conn.Open();
                    // 현재 로그인 사용자와 같거나 낮은 레벨의 사람만 조회해서 가져옴
                    cmd.CommandText = $"SELECT ID, NAME, ENTRY, MODIFICATION, LEVEL FROM MEMBER WHERE LEVEL <= {level.ToString()}";
                    OdbcDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        var user = new User2Model();
                        user.Id     = (string)reader[0];
                        user.Name   = (string)reader[1];
                        user.Entry  = (DateTime)reader[2];
                        user.Modify = (DateTime)reader[3];
                        user.Level  = (int)reader[4];
                        model.Add(user);
                    }

                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Error Read All Member", ex);
                }
                finally
                {
                    if (conn != null)
                    {
                        conn.Dispose();
                    }
                }
            }
            return(model);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 根据审批岗位获取审批人(包括岗位id为0的发起人)
        /// </summary>
        /// <param name="recordModel"></param>
        /// <returns></returns>
        public List <GAppvalPost4OperModel> GetOperators(GAppvalRecordModel recordModel)
        {
            List <GAppvalPost4OperModel> operModels = new List <GAppvalPost4OperModel>();

            if (recordModel == null)
            {
                return(operModels);
            }


            if (recordModel.PostPhid == 0)
            {
                if (recordModel.RefbillPhid == 0)
                {
                    return(operModels);
                }
                else
                {
                    try
                    {
                        GAppvalRecordModel model = GAppvalRecordFacade.Find(t => t.RefbillPhid == recordModel.RefbillPhid && t.PostPhid == 0).Data[0];
                        User2Model         user  = UserFacade.Find(model.OperaPhid).Data;
                        operModels.Add(new GAppvalPost4OperModel {
                            PostPhid     = 0,
                            OperatorPhid = user.PhId,
                            OperatorName = user.UserName
                        });
                    }
                    catch (Exception e) {
                        throw new Exception("查询发起人失败!");
                    }
                }
            }
            else
            {
                try
                {
                    operModels = GAppvalPost4OperFacade.GetOperatorsByPostID(recordModel.PostPhid);
                }
                catch (Exception e) {
                    throw new Exception("根据岗位id查找操作失败!");
                }
            }

            return(operModels);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public string Save2()
        {
            string       Userdata    = System.Web.HttpContext.Current.Request.Params["Userdata"];
            string       adddata     = System.Web.HttpContext.Current.Request.Params["adddata"];
            string       deletedata  = System.Web.HttpContext.Current.Request.Params["deletedata"];
            User2Model   User        = JsonConvert.DeserializeObject <User2Model>(Userdata);
            var          addinfo     = JsonConvert.DeserializeObject <List <QTProductUserDygxModel> >(adddata);
            var          deleteinfo  = JsonConvert.DeserializeObject <List <string> >(deletedata);
            CommonResult savedresult = new CommonResult();

            try
            {
                savedresult = QTProductUserDygxService.Save2(User, addinfo, deleteinfo);
            }
            catch (Exception ex)
            {
                savedresult.Status = ResponseStatus.Error;
                savedresult.Msg    = ex.Message.ToString();
            }
            return(DataConverterHelper.SerializeObject(savedresult));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 保存预决算报表
        /// </summary>
        /// <param name="ysAccountMst">对象</param>
        /// <param name="orgId">组织id</param>
        /// <param name="orgCode">组织code</param>
        /// <param name="year">年份</param>
        /// <param name="uid">用户id</param>
        /// <param name="verify">用来判断年初,年中,年末(1、年初,2、年中,3、年末)</param>
        /// <returns></returns>
        public SavedResult <long> SaveYsAccount(YsAccountMstModel ysAccountMst, long orgId, string orgCode, string year, long uid, string verify)
        {
            //根据用户id获取用户对象
            User2Model user = new User2Model();

            if (this.UserRule.Find(t => t.PhId == uid) != null && this.UserRule.Find(t => t.PhId == uid).Count > 0)
            {
                user = this.UserRule.Find(t => t.PhId == uid)[0];
            }
            else
            {
                throw new Exception("用户查询失败!");
            }
            //根据组织id获取组织对象
            OrganizeModel org = new OrganizeModel();

            if (this.OrganizationRule.Find(t => t.PhId == orgId) != null && this.OrganizationRule.Find(t => t.PhId == orgId).Count > 0)
            {
                org = this.OrganizationRule.Find(t => t.PhId == orgId)[0];
            }
            else
            {
                throw new Exception("组织查询失败!");
            }
            SavedResult <long>        savedResult   = new SavedResult <long>();
            IList <YsAccountMstModel> ysAccountMsts = new List <YsAccountMstModel>();

            ysAccountMsts = this.YsAccountMstRule.Find(t => t.Orgid == orgId && t.Uyear == year);
            if (ysAccountMsts != null && ysAccountMsts.Count > 0)
            {
                if (ysAccountMst.PhId == 0)
                {
                    throw new Exception("主表主键传递有误!");
                }
                if ("1".Equals(verify) && ysAccountMsts[0].VerifyStart == 1)
                {
                    throw new Exception("年初申报数据已上报,不能修改!");
                }
                else if ("2".Equals(verify) && ysAccountMsts[0].VerifyMiddle == 1)
                {
                    throw new Exception("年中调整数据已上报,不能修改!");
                }
                else if ("3".Equals(verify) && ysAccountMsts[0].VerifyEnd == 1)
                {
                    throw new Exception("年末决算数据已上报,不能修改!");
                }
                ysAccountMst.PersistentState = PersistentState.Modified;
                if ("1".Equals(verify) && ysAccountMst.VerifyStart == 1)
                {
                    ysAccountMst.VerifyStartTime = DateTime.Now;
                    ysAccountMst.StartReportDate = DateTime.Now;
                    ysAccountMst.StartReportMan  = user.UserName;
                }
                else if ("2".Equals(verify) && ysAccountMst.VerifyMiddle == 1)
                {
                    if (ysAccountMsts[0].VerifyStart != 1)
                    {
                        throw new Exception("年初还未上报,不能进行年中的上报!");
                    }
                    ysAccountMst.VerifyMiddleTime = DateTime.Now;
                    ysAccountMst.MiddleReportDate = DateTime.Now;
                    ysAccountMst.MiddleReportMan  = user.UserName;
                }
                else if ("3".Equals(verify) && ysAccountMst.VerifyEnd == 1)
                {
                    if (ysAccountMsts[0].VerifyStart != 1 || ysAccountMsts[0].VerifyMiddle != 1)
                    {
                        throw new Exception("年初或者年中还未上报,不能进行年末的上报!");
                    }
                    ysAccountMst.VerifyEndTime = DateTime.Now;
                    ysAccountMst.EndReportDate = DateTime.Now;
                    ysAccountMst.EndReportMan  = user.UserName;
                }
                //保存主表数据
                savedResult = this.YsAccountMstRule.Save <long>(ysAccountMst);

                IList <YsAccountModel> ysAccounts = new List <YsAccountModel>();
                //已存在的明细数据
                ysAccounts = this.YsAccountRule.Find(t => t.PHIDMST == ysAccountMst.PhId && t.UYEAR == year && t.ORGID == org.PhId);
                if (ysAccountMst.YsAccounts != null && ysAccountMst.YsAccounts.Count > 0)
                {
                    foreach (var account in ysAccountMst.YsAccounts)
                    {
                        account.PHIDMST = savedResult.KeyCodes[0];
                        if (ysAccounts != null && ysAccounts.Count > 0)
                        {
                            if (ysAccounts.ToList().Find(t => t.PhId == account.PhId) != null)
                            {
                                account.PersistentState = PersistentState.Modified;
                            }
                            else
                            {
                                account.PersistentState = PersistentState.Added;
                            }
                            if ("1".Equals(verify))
                            {
                                account.VERIFYSTART     = ysAccountMst.VerifyStart;
                                account.VERIFYSTARTTIME = ysAccountMst.VerifyStartTime;
                            }
                            else if ("2".Equals(verify))
                            {
                                account.VERIFYMIDDLE     = ysAccountMst.VerifyMiddle;
                                account.VERIFYMIDDLETIME = ysAccountMst.VerifyMiddleTime;
                            }
                            else if ("3".Equals(verify))
                            {
                                account.VERIFYEND     = ysAccountMst.VerifyEnd;
                                account.VERIFYENDTIME = ysAccountMst.VerifyEndTime;
                            }
                        }
                        else
                        {
                            throw new Exception("原明细数据有误!");
                        }
                    }
                    //保存明细表数据
                    this.YsAccountRule.Save <long>(ysAccountMst.YsAccounts);
                }
                else
                {
                    throw new Exception("明细表数据不能为空!");
                }
            }
            else
            {
                ysAccountMst.PersistentState = PersistentState.Added;
                if ("1".Equals(verify) && ysAccountMst.VerifyStart == 1)
                {
                    ysAccountMst.VerifyStartTime = DateTime.Now;
                    ysAccountMst.StartReportDate = DateTime.Now;
                    ysAccountMst.StartReportMan  = user.UserName;
                }
                else if ("2".Equals(verify) && ysAccountMst.VerifyMiddle == 1)
                {
                    throw new Exception("年初还未上报,不能进行年中的上报!");
                    //ysAccountMst.VerifyMiddleTime = DateTime.Now;
                    //ysAccountMst.MiddleReportDate = DateTime.Now;
                    //ysAccountMst.MiddleReportMan = user.UserName;
                }
                else if ("3".Equals(verify) && ysAccountMst.VerifyEnd == 1)
                {
                    throw new Exception("年初或者年中还未上报,不能进行年末的上报!");
                    //ysAccountMst.VerifyEndTime = DateTime.Now;
                    //ysAccountMst.EndReportDate = DateTime.Now;
                    //ysAccountMst.EndReportMan = user.UserName;
                }
                //保存主表数据
                savedResult = this.YsAccountMstRule.Save <long>(ysAccountMst);

                if (ysAccountMst.YsAccounts != null && ysAccountMst.YsAccounts.Count > 0)
                {
                    foreach (var account in ysAccountMst.YsAccounts)
                    {
                        account.PersistentState = PersistentState.Added;
                        account.PHIDMST         = savedResult.KeyCodes[0];
                        if ("1".Equals(verify))
                        {
                            account.VERIFYSTART     = ysAccountMst.VerifyStart;
                            account.VERIFYSTARTTIME = ysAccountMst.VerifyStartTime;
                        }
                        else if ("2".Equals(verify))
                        {
                            account.VERIFYMIDDLE     = ysAccountMst.VerifyMiddle;
                            account.VERIFYMIDDLETIME = ysAccountMst.VerifyMiddleTime;
                        }
                        else if ("3".Equals(verify))
                        {
                            account.VERIFYEND     = ysAccountMst.VerifyEnd;
                            account.VERIFYENDTIME = ysAccountMst.VerifyEndTime;
                        }
                    }
                    //保存明细表数据
                    this.YsAccountRule.Save <long>(ysAccountMst.YsAccounts);
                }
                else
                {
                    throw new Exception("明细表数据不能为空!");
                }
            }
            return(savedResult);
        }
Ejemplo n.º 12
0
 public bool Update(User2Model model)
 {
     return(_res.Update(model));
 }
Ejemplo n.º 13
0
 public bool Create(User2Model model)
 {
     return(_res.Create(model));
 }
Ejemplo n.º 14
0
        public string GetYearStartCover([FromUri] BaseListModel parameter)
        {
            if (parameter == null)
            {
                return(DCHelper.ErrorMessage("请求参数为空!"));
            }

            if (parameter.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }

            if (parameter.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            if (String.IsNullOrEmpty(parameter.Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }
            //value来判断是年初,年中,年末预算说明说
            if (String.IsNullOrEmpty(parameter.value))
            {
                return(DCHelper.ErrorMessage("判断年初,年中,年末的value条件为空!"));
            }

            //获取组织和用户信息
            User2Model    userModel     = new User2Model();
            OrganizeModel organizeModel = new OrganizeModel();

            try
            {
                userModel = this.BudgetMstService.GetUser(parameter.uid);
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage("获取用户信息失败!"));
            }

            try
            {
                organizeModel = this.BudgetMstService.GetOrganize(parameter.orgid);
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage("获取组织信息失败!"));
            }
            FileStream fs     = null;
            FileStream output = null;

            try
            {
                string title    = "";
                string content1 = "";
                string content2 = "";
                if ("1".Equals(parameter.value))
                {
                    title    = "预算表";
                    content1 = "预算说明书";
                    content2 = "经费收支预算表";
                }
                else if ("2".Equals(parameter.value))
                {
                    title    = "预算表(年中调整)";
                    content1 = "预算说明书(年中调整)";
                    content2 = "经费收支预算表(年中调整)";
                }
                else if ("3".Equals(parameter.value))
                {
                    title    = "决算表";
                    content1 = "决算说明书";
                    content2 = "经费决算预算表";
                }

                string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".docx";
                string filePath = HostingEnvironment.MapPath("~/DownLoadFiles/SubjectBudget");
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                File.Copy(HostingEnvironment.MapPath("~" + "/DownLoadFiles/template/预算封面.docx"), filePath + "/" + filename, true);

                fs = new FileStream(filePath + "/" + filename, FileMode.Open, FileAccess.Read);

                XWPFDocument document = new XWPFDocument(fs);
                foreach (var para in document.Paragraphs)
                {
                    string oldContext = para.ParagraphText;
                    if (String.IsNullOrEmpty(oldContext))
                    {
                        continue;
                    }
                    string context = para.ParagraphText;
                    if (context.Contains("{$date}"))
                    {
                        context = context.Replace("{$date}", DateTime.Now.ToString("yyyy/MM/dd"));
                    }
                    if (context.Contains("{$chairman}"))
                    {
                        context = context.Replace("{$chairman}", userModel.UserName);
                    }
                    if (context.Contains("{$treasurer}"))
                    {
                        context = context.Replace("{$treasurer}", userModel.UserName);
                    }
                    if (context.Contains("{$maker}"))
                    {
                        context = context.Replace("{$maker}", userModel.UserName);
                    }
                    if (context.Contains("{$checker}"))
                    {
                        context = context.Replace("{$checker}", "");
                    }
                    if (context.Contains("{$year}"))
                    {
                        context = context.Replace("{$year}", DateTime.Now.Year.ToString());
                    }
                    if (context.Contains("{$month}"))
                    {
                        context = context.Replace("{$month}", DateTime.Now.Month.ToString());
                    }
                    if (context.Contains("{$day}"))
                    {
                        context = context.Replace("{$day}", DateTime.Now.Day.ToString());
                    }
                    if (context.Contains("{$title}"))
                    {
                        context = context.Replace("{$title}", title);
                    }
                    if (context.Contains("{$content1}"))
                    {
                        context = context.Replace("{$content1}", content1);
                    }
                    if (context.Contains("{$content2}"))
                    {
                        context = context.Replace("{$content2}", content2);
                    }

                    if (oldContext != context)
                    {
                        para.ReplaceText(oldContext, context);
                    }
                }
                output = new FileStream(filePath + "/" + filename, FileMode.Create);
                document.Write(output);
                fs.Close();
                fs.Dispose();
                output.Close();
                output.Dispose();

                return(DataConverterHelper.SerializeObject(new { path = filePath, filename = filename }));
            }
            catch (Exception ex)
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
                if (output != null)
                {
                    output.Close();
                    output.Dispose();
                }
                return(DCHelper.ErrorMessage("导出年初申报的封面失败!" + ex.Message));
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="User"></param>
        /// <param name="adddata"></param>
        /// <param name="deletedata"></param>
        /// <returns></returns>
        public CommonResult Save2(User2Model User, List <QTProductUserDygxModel> adddata, List <string> deletedata)
        {
            CommonResult result = new CommonResult();

            try
            {
                if (adddata != null && adddata.Count > 0)
                {
                    for (var i = 0; i < adddata.Count; i++)
                    {
                        QTProductUserDygxModel qTProductUserDygxModel = adddata[i];
                        //Dictionary<string, object> dic1 = new Dictionary<string, object>();
                        //new CreateCriteria(dic1).Add(ORMRestrictions<string>.Eq("ProductBZ", qTProductUserDygxModel.ProductBZ));
                        //QTProductModel qTProductModel = QTProductFacade.Find(dic1).Data[0];
                        //qTProductUserDygxModel.ProductPhid = qTProductModel.PhId;
                        Dictionary <string, object> dic2 = new Dictionary <string, object>();
                        new CreateCriteria(dic2).Add(ORMRestrictions <string> .Eq("ProductBZ", qTProductUserDygxModel.ProductBZ))
                        .Add(ORMRestrictions <string> .Eq("ProductUserCode", qTProductUserDygxModel.ProductUserCode));
                        QTProductUserModel qTProductUserModel = QTProductUserFacade.Find(dic2).Data[0];
                        if (qTProductUserDygxModel.PhId == 0)
                        {
                            qTProductUserDygxModel.ProductPhid     = qTProductUserModel.ProductPhid;
                            qTProductUserDygxModel.ProductUserPhid = qTProductUserModel.PhId;
                            qTProductUserDygxModel.ProductUserName = qTProductUserModel.ProductUserName;
                            qTProductUserDygxModel.ProductUserPwd  = qTProductUserModel.ProductUserPwd;
                            qTProductUserDygxModel.Fg3userPhid     = User.PhId;
                            qTProductUserDygxModel.Fg3userno       = User.UserNo;
                            qTProductUserDygxModel.Fg3username     = User.UserName;
                            qTProductUserDygxModel.PersistentState = PersistentState.Added;
                            base.Save <Int64>(qTProductUserDygxModel, "");
                        }
                        else
                        {
                            QTProductUserDygxModel qTProductUserDygxModel2 = base.Find(qTProductUserDygxModel.PhId).Data;
                            qTProductUserDygxModel2.ProductBZ       = qTProductUserDygxModel.ProductBZ;
                            qTProductUserDygxModel2.ProductUserCode = qTProductUserDygxModel.ProductUserCode;
                            qTProductUserDygxModel2.ProductPhid     = qTProductUserModel.ProductPhid;
                            qTProductUserDygxModel2.ProductUserPhid = qTProductUserModel.PhId;
                            qTProductUserDygxModel2.ProductUserName = qTProductUserModel.ProductUserName;
                            qTProductUserDygxModel2.ProductUserPwd  = qTProductUserModel.ProductUserPwd;
                            qTProductUserDygxModel2.Fg3userPhid     = User.PhId;
                            qTProductUserDygxModel2.Fg3userno       = User.UserNo;
                            qTProductUserDygxModel2.Fg3username     = User.UserName;
                            qTProductUserDygxModel2.PersistentState = PersistentState.Modified;
                            base.Save <Int64>(qTProductUserDygxModel2, "");
                        }
                    }
                }
                if (deletedata != null && deletedata.Count > 0)
                {
                    for (var j = 0; j < deletedata.Count; j++)
                    {
                        base.Delete(deletedata[j]);
                    }
                }
            }
            catch (Exception e)
            {
                result.Status = ResponseStatus.Error;
                result.Msg    = "保存失败!";
            }
            return(result);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 回退时,获取之前的所有岗位,包括发起人(岗位id为0)
        /// </summary>
        /// <param name="recordModel"></param>
        /// <returns></returns>
        public List <GAppvalPostModel> GetBackApprovalPost(GAppvalRecordModel recordModel)
        {
            List <GAppvalPostModel> postModels = new List <GAppvalPostModel>();

            if (recordModel == null || recordModel.ProcPhid == 0 || recordModel.PostPhid == 0)
            {
                return(postModels);
            }

            postModels.Add(new GAppvalPostModel {
                PhId  = 0,
                FName = "发起人"
            });

            //当前审批流程的所有审批岗位
            List <GAppvalPostModel> allPosts = GAppvalPostFacade.FindAppvalPostByProcID(recordModel.ProcPhid).OrderBy(t => t.Seq).ToList();
            //当前岗位
            GAppvalPostModel presentPost = allPosts.Find(t => t.PhId == recordModel.PostPhid);
            //当前岗位之前的岗位
            List <GAppvalPostModel> beforePosts = allPosts.FindAll(t => t.Seq < presentPost.Seq);

            postModels.AddRange(beforePosts);

            foreach (GAppvalPostModel postModel in postModels)
            {
                if (postModel.PhId == 0)
                {
                    if (recordModel.RefbillPhid == 0)
                    {
                        postModel.Operators = null;
                    }
                    else
                    {
                        try
                        {
                            List <GAppvalPost4OperModel> operModels = new List <GAppvalPost4OperModel>();
                            GAppvalRecordModel           model      = GAppvalRecordFacade.Find(t => t.RefbillPhid == recordModel.RefbillPhid && t.PostPhid == 0).Data[0];
                            User2Model user = UserFacade.Find(model.OperaPhid).Data;
                            operModels.Add(new GAppvalPost4OperModel
                            {
                                PostPhid     = 0,
                                OperatorPhid = user.PhId,
                                OperatorName = user.UserName
                            });
                            postModel.Operators = operModels;
                        }
                        catch (Exception e)
                        {
                            throw new Exception("查询发起人失败!");
                        }
                    }
                }
                else
                {
                    try
                    {
                        postModel.Operators = GAppvalPost4OperFacade.GetOperatorsByPostID(postModel.PhId);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("根据岗位id查找操作失败!");
                    }
                }
            }


            return(postModels);
        }