Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputPayEntity"></param>
        /// <param name="existingPayEntity"></param>
        /// <param name="lastPayInfoDetailsEntity"></param>
        /// <param name="db"></param>
        public PayToolsBase(Pay_InfoEntity entity)
        {
            this._inputPayEntity = entity;
            #region 为了保证下面的数据都是一致的所以这里把该查的数据都一起查出来
            //项目信息
            var projectInfo = new Base_ProjectInfoEntity();


            if (entity.Project_Id != null)
            {
                _projectInfoEntity = projectService.GetEntityBase(entity.Project_Id);
            }
            if (_projectInfoEntity == null)
            {
                throw new Exception("项目信息不正确!");
            }
            //数据库存储的付款单
            this._existingPayEntity = payInfoService.GetEntity(entity.Pay_Info_Id);
            if (existingPayEntity != null)
            {
                this._lastPayInfoDetailsEntity = payDeailsService.GetEntityByCode(existingPayEntity.LastPayInfoDetailsCode);
            }
            this._ecommerceProjectMoneyCapacity = eprService.GetTrunkEntity(entity.Project_Id, entity.EcommerceID);
            if (_ecommerceProjectMoneyCapacity == null)
            {
                throw new Exception("未找到对应的电商合同!");
            }
            _codeNumber = coderuleService.SetBillCodeByCode("System", "100");
            #endregion

            try
            {
                string errMsg = string.Empty;

                if (existingPayEntity != null)
                {
                    inputPayEntity.Modify(inputPayEntity.Pay_Info_Id);
                    new RepositoryFactory().BaseRepository().Update(inputPayEntity);
                }
                else
                {
                    inputPayEntity.CompanyID   = projectInfoEntity.CompanyCode;
                    inputPayEntity.CompanyName = projectInfoEntity.CompanyName;
                    inputPayEntity.Create();
                    new RepositoryFactory().BaseRepository().Insert(inputPayEntity);
                }

                Transdb = new RepositoryFactory().BaseRepository().BeginTrans();
            }
            catch (Exception ex)
            {
                Transdb.Rollback();
                throw new Exception(ex.Message);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, Base_ProjectInfoEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, Base_ProjectInfoEntity entity)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         entity.Modify(keyValue);
         this.BaseRepository().Update(entity);
     }
     else
     {
         entity.Create();
         this.BaseRepository().Insert(entity);
     }
 }
 public ActionResult SaveForm(string keyValue, Base_ProjectInfoEntity entity)
 {
     base_projectinfobll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
Esempio n. 5
0
        /// <summary>
        /// 作者:姚栋
        /// 日期:2018-05-30
        /// 描述:给某个岗位进行项目授权
        /// </summary>
        ///  <param name="authorizeType">授权类型</param>
        /// <param name="postId">岗位Id</param>
        /// <param name="moduleIds">项目Id集合</param>·
        /// <returns></returns>

        public void SaveAuthorizeAndPost(AuthorizeTypeEnum authorizeType, string postId, string[] projectColumnIds, string[] arryprojectNames)
        {
            var projectList = this.BaseRepository().IQueryable <Base_ProjectInfoEntity>().ToList();

            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                if (projectColumnIds.Length != arryprojectNames.Length)
                {
                    throw new Exception("授权数据异常!");
                }


                #region 数据权限

                int SortCode = 1;
                Base_ProjectInfoEntity currentProject = null;
                for (int i = 0; i < projectColumnIds.Length; i++)
                {
                    currentProject = projectList.FirstOrDefault(p => p.ProjectID == projectColumnIds[i]);
                    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                    authorizeEntity.Create();
                    authorizeEntity.Category = (int)authorizeType;
                    authorizeEntity.ObjectId = postId;
                    authorizeEntity.ItemType = (int)AuthorizeItmeTypeEnum.ProjectInfo;
                    authorizeEntity.ItemId   = projectColumnIds[i];
                    authorizeEntity.ItemName = arryprojectNames[i];
                    authorizeEntity.SortCode = SortCode++;
                    if (currentProject != null)
                    {
                        authorizeEntity.Remark1 = currentProject.CompanyName;
                        authorizeEntity.Remark2 = currentProject.CityName;
                    }

                    db.Insert(authorizeEntity);
                }
                //foreach (string item in projectColumnIds)
                //{
                //    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                //    authorizeEntity.Create();
                //    authorizeEntity.Category = (int)authorizeType;
                //    authorizeEntity.ObjectId = postId;
                //    authorizeEntity.ItemType = (int)AuthorizeItmeTypeEnum.ProjectInfo;
                //    authorizeEntity.ItemId = item;
                //    authorizeEntity.SortCode = SortCode++;
                //    db.Insert(authorizeEntity);
                //}
                #endregion
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"update Base_Role set AuthorizationMethod=@AuthorizationMethod where RoleId=@PostID");
                var parameter = new List <DbParameter>();
                parameter.Add(DbParameters.CreateDbParameter("@PostID", postId));
                parameter.Add(DbParameters.CreateDbParameter("@AuthorizationMethod", (int)AuthorizationMethodEnum.CustomizeProject));
                db.ExecuteBySql(strSql.ToString(), parameter.ToArray());
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception(ex.Message);
            }
        }