Example #1
0
        /// <summary>
        /// 更新组织信息
        /// </summary>
        /// <param name="orgModel"></param>
        /// <returns></returns>
        public bool update(OrgModel orgModel)
        {
            using (SqlSugarClient db = BaseDB.GetClient())
            {
                try
                {
                    //db.BeginTran();//开启事务
                    //特别说明:在事务中,默认情况下是使用锁的,也就是说在当前事务没有结束前,其他的任何查询都需要等待
                    //ReadCommitted:在正在读取数据时保持共享锁,以避免脏读,但是在事务结束之前可以更改数据,从而导致不可重复的读取或幻像数据。
                    //db.BeginTran(System.Data.IsolationLevel.ReadCommitted); //重载指定事务的级别
                    db.BeginTran();//开始事物
                    db.Updateable <Organization>(orgModel.organization);

                    //组织关系表不会发生变化 不需要处理
                    //Dictionary<string, Object> updatec = new Dictionary<string, object>();
                    // updatec.Add("",)
                    // db.Updateable<OrganizationOrg>(updatec).Where(org=>org.orgid == orgModel.parentOrgId);
                    db.CommitTran();//提交事务
                    return(true);
                }
                catch (Exception ex)
                {
                    db.RollbackTran();//回滚
                    return(false);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 通过用户编码查询用户信息
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public UserModel getUserModelByCode(string userCode)
        {
            using (SqlSugarClient db = BaseDB.GetClient())
            {
                try
                {
                    List <UserModel> res = db.Queryable <User, OrganizationUser>((u, ou) => new object[] {
                        JoinType.Left, u.id == ou.userid
                    })
                                           .Where((u, ou) => u.userCode == userCode)
                                           .Select((u, ou) => new UserModel
                    {
                        organizationUser = ou,
                        user             = u
                    })

                                           .ToList();
                    if (res.Count > 0)
                    {
                        return(res[0]);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    return(null);
                }
            }
        }
Example #3
0
 /// <summary>
 /// 技术服务商个人信息并返回id
 /// </summary>
 /// <param name="fqualification"></param>
 /// <returns></returns>
 public int AddFacilitator(Facilitator_Qualification fqualification)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         Facilitator facilitator = new Facilitator()
         {
             ApplicantEmail     = fqualification.ApplicantEmail,
             ApplicantName      = fqualification.ApplicantName,
             CellPhone          = fqualification.CellPhone,
             CompanyName        = fqualification.CompanyName,
             ContactEmail       = fqualification.ContactEmail,
             ContactName        = fqualification.ContactName,
             ContactNumber      = fqualification.ContactNumber,
             ContactPhone       = fqualification.ContactPhone,
             CreditCode         = fqualification.CreditCode,
             Email              = fqualification.Email,
             Postcode           = fqualification.Postcode,
             QualificationId    = fqualification.QualificationId,
             RegistrationAddres = fqualification.RegistrationAddres,
             RegistrationCode   = fqualification.RegistrationCode,
             RepresentativeName = fqualification.RepresentativeName,
             ServiceType        = fqualification.ServiceType
         };
         var result = db.Insertable <Facilitator>(facilitator).ExecuteReturnIdentity();
         return(result);
     }
 }
Example #4
0
 /// <summary>
 /// 添加图片信息
 /// </summary>
 /// <param name="audio"></param>
 /// <returns></returns>
 public int AddPicture(Picture picture)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Insertable <Picture>(picture).ExecuteCommand();
         return(i);
     }
 }
Example #5
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public int UpdateUserPwd(User user)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Updateable(user).ExecuteCommand();
         return(i);
     }
 }
Example #6
0
 /// <summary>
 /// 下拉显示
 /// </summary>
 /// <returns></returns>
 public List <UserInfo> GetFacilitators()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <Facilitator, User>((sc, st) => new object[] { JoinType.Inner, st.UserInfoId == sc.Id }).Select <UserInfo>().Where(st => st.UserTypeId == 2).ToList();
         return(list);
     }
 }
Example #7
0
 /// <summary>
 /// 修改账号信息
 /// </summary>
 /// <param name="facilitator"></param>
 /// <returns></returns>
 public int UpdateFacilitator(Facilitator facilitator)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Updateable(facilitator).ExecuteCommand();
         return(i);
     }
 }
Example #8
0
 /// <summary>
 /// 显示关联信息回填信息
 /// </summary>
 /// <returns></returns>
 public List <Facilitator> FacilitatorList()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var getList = db.Queryable <Facilitator>().ToList();
         return(getList);
     }
 }
Example #9
0
 /// <summary>
 /// 显示音频信息
 /// </summary>
 /// <returns></returns>
 public List <Audio> GetAudios()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <Audio>().ToList();
         return(list);
     }
 }
Example #10
0
 /// <summary>
 /// 添加音频信息
 /// </summary>
 /// <param name="audio"></param>
 /// <returns></returns>
 public int AddAudio(Audio audio)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Insertable <Audio>(audio).ExecuteCommand();
         return(i);
     }
 }
Example #11
0
 /// <summary>
 /// 显示图片信息
 /// </summary>
 /// <returns></returns>
 public List <Picture> GetPictures()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <Picture>().ToList();
         return(list);
     }
 }
Example #12
0
 /// <summary>
 /// 修改期刊
 /// </summary>
 /// <param name="joural"></param>
 /// <returns></returns>
 public int UpdateJoural(JouralApply joural)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Updateable <JouralApply>(joural).ExecuteCommand();
         return(i);
     }
 }
Example #13
0
 /// <summary>
 /// 添加富文本
 /// </summary>
 /// <param name="richText"></param>
 /// <returns></returns>
 public int AddRichText(RichText richText)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Insertable <RichText>(richText).ExecuteCommand();
         return(i);
     }
 }
 /// <summary>
 /// 提交授权
 /// </summary>
 /// <param name="authorize"></param>
 /// <returns></returns>
 public int AddAuthorize(Authorize authorize)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Insertable(authorize).ExecuteCommand();
         return(i);
     }
 }
Example #15
0
        /// <summary>
        /// 修改图书,ISLI编码
        /// </summary>
        /// <param name="books"></param>
        /// <returns></returns>

        public int Update(Books books)
        {
            using (SqlSugarClient db = BaseDB.GetClient())
            {
                var i = db.Updateable(books).ExecuteCommand();
                return(i);
            }
        }
Example #16
0
 /// <summary>
 /// 添加关联信息应用
 /// </summary>
 /// <param name="adhibition"></param>
 /// <returns></returns>
 public List <Adhibition> GetAdhibitions()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <Adhibition>().ToList();
         return(list);
     }
 }
Example #17
0
 /// <summary>
 /// 编辑关联信息
 /// </summary>
 /// <param name="adhibition"></param>
 /// <returns></returns>
 public int UpdateAdhibition(Adhibition adhibition)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Updateable(adhibition).ExecuteCommand();
         return(i);
     }
 }
Example #18
0
 /// <summary>
 /// 显示关联信息
 /// </summary>
 /// <returns></returns>
 public int AddAdhibition(Adhibition adhibition)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var i = db.Insertable <Adhibition>(adhibition).ExecuteCommand();
         return(i);
     }
 }
Example #19
0
 /// <summary>
 /// 显示所有期刊
 /// </summary>
 /// <returns></returns>
 public List <JouralApply> GetJourals()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <JouralApply>();
         return(list.ToList());
     }
 }
Example #20
0
 /// <summary>
 /// 显示富文本
 /// </summary>
 /// <returns></returns>
 public List <RichText> GetRichTexts()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <RichText>().ToList();
         return(list);
     }
 }
 /// <summary>
 /// 获取数据
 /// </summary>
 /// <returns></returns>
 public List <PublishApply> GetPublishApplysList()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var list = db.Queryable <User, Publisher>((st, sc) => new object[] { JoinType.Inner, st.UserInfoId == sc.PId }).Select <PublishApply>().Where(st => st.UserTypeId == 2).ToList();
         return(list);
     }
 }
 /// <summary>
 /// 显示授权详情表
 /// </summary>
 /// <returns></returns>
 public List <Authorize> AuthorizeList()
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var getList = db.Queryable <Authorize>().ToList();
         return(getList);
     }
 }
Example #23
0
 /// <summary>
 /// 根据iD获取对象
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Books BooksUpdateById(int id)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         //根据条件查询
         var books = db.Queryable <Books>().Where(m => m.Id == id).First();
         return(books);
     }
 }
 /// <summary>
 /// 根据iD获取对象
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public PublishApply UpdateById(int id)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         //根据条件查询
         var publishApply = db.Queryable <User, Publisher>((st, sc) => new object[] { JoinType.Inner, st.UserInfoId == sc.PId }).Select <PublishApply>().Where(sc => sc.PId == id).First();
         return(publishApply);
     }
 }
Example #25
0
 /// <summary>
 /// 添加图书,ISLI编码
 /// </summary>
 /// <param name="books"></param>
 /// <returns></returns>
 public int Add(Books books)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         //插入并返回受影响行数用ExecuteCommand
         int i = db.Insertable <Books>(books).ExecuteCommand();
         return(i);
     }
 }
Example #26
0
 /// <summary>
 /// 修改提交状态(通过)
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int UpdateBooksSbumissionStateToPass(Books books)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var m = db.Updateable <Books>().UpdateColumns(it => new Books()
         {
             ApplyState = 2
         }).Where(it => it.Id == books.Id).ExecuteCommand();
         return(m);
     }
 }
 /// <summary>
 /// 修改提交状态(拒绝)
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int UpdateSbumissionStateToDeny(PublishApply publishApply)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         var m = db.Updateable <User>().UpdateColumns(it => new User()
         {
             SubmissionState = 2
         }).Where(it => it.Id == publishApply.PId).ExecuteCommand();
         return(m);
     }
 }
 /// <summary>
 /// 修改用户启用状态
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int UpdateEnableState(PublishApply publishApply)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         //修改为冻结
         var m = db.Updateable <User>().UpdateColumns(it => new User()
         {
             IsEnabled = 0
         }).Where(it => it.Id == publishApply.PId).ExecuteCommand();
         return(m);
     }
 }
Example #29
0
 /// <summary>
 /// 企业资质证明并返回id
 /// </summary>
 /// <param name="fqualification"></param>
 /// <returns></returns>
 public int AddQualification(Facilitator_Qualification fqualification)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         Qualification qualification = new Qualification()
         {
             RegTime       = DateTime.Now,
             Type          = fqualification.Type,
             UnifiedSocial = fqualification.UnifiedSocial
         };
         var result = db.Insertable <Qualification>(qualification).ExecuteReturnIdentity();
         return(result);
     }
 }
 /// <summary>
 /// 分页方法
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pagesize"></param>
 /// <param name="totalCount"></param>
 /// <returns></returns>
 public PageResult <PublishApply> Paging(PageParams pageParams)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         // List<PublishApply> page = db.Queryable<PublishApply>().ToPageList(pageIndex, pageSize, ref totalCount);
         var page = db.Queryable <User, Publisher>((st, sc) => new object[] { JoinType.Inner, st.UserInfoId == sc.PId }).Select <PublishApply>().ToPageList(pageParams.PageIndex, pageParams.PageSize, ref totalCount);
         PageResult <PublishApply> pageResult = new PageResult <PublishApply>();
         pageResult.TotalCount = totalCount;
         int i = totalCount / pageParams.PageSize;
         pageResult.TotalPage = totalCount % pageParams.PageSize == 0 ? i : i + 1;
         pageResult.DataList  = page;
         return(pageResult);
     }
 }