示例#1
0
        public void BindOpenId(int userId, string openId, bool single = false)
        {
            List <WxUser> list;

            if (single)
            {
                list = m_repWxUser.GetByCondition(r => r.UserId == userId);
            }
            else
            {
                list = m_repWxUser.GetByCondition(r => r.UserId == userId && r.OpenId == openId);
            }

            WxUser user = new WxUser()
            {
                UserId = userId, OpenId = openId, NoMsg = false
            };

            if (list.Count == 0)
            {
                m_repWxUser.Insert(user);
            }
            else if (single)
            {
                m_repWxUser.DeleteByCondition(r => r.UserId == userId);
                m_repWxUser.Insert(user);
            }
        }
示例#2
0
 public bool DeleteSysDict(int id, out string errorMsg)
 {
     errorMsg = string.Empty;
     try
     {
         int deleteCount = rep.DeleteByCondition(d => d.Id == id || d.CategoryId == id);
         return(true);
     }
     catch (Exception ex)
     {
         errorMsg = ex.Message;
         return(false);
     }
 }
示例#3
0
        /// <summary>
        /// 分配专家
        /// </summary>
        /// <param name="model"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        public bool SaveDistributeExpert(t_D_UserTableTen model, out string errorMsg)
        {
            using (var db = dbFactory.Open())
            {
                using (var dbTrans = db.OpenTransaction())
                {
                    try
                    {
                        errorMsg = string.Empty;

                        int needUnitBuildingQualify = 0; //是否需要填写 建设工程质量检测资质机构审核表
                        int needSpecialQualify      = 0; //是否需要填写 专项检测备案审核表
                        var tbTwo = repTwo.GetByCondition(r => r.pid == model.pid).FirstOrDefault();
                        if (tbTwo != null)
                        {
                            if (tbTwo.sqjcyw.IndexOf("地基基础工程检测") >= 0 ||
                                tbTwo.sqjcyw.IndexOf("主体结构工程现场检测") >= 0 ||
                                tbTwo.sqjcyw.IndexOf("建筑幕墙工程检测") >= 0 ||
                                tbTwo.sqjcyw.IndexOf("钢结构工程检测") >= 0 ||
                                tbTwo.sqjcyw.IndexOf("见证取样检测") >= 0)
                            {
                                needUnitBuildingQualify = 1;
                            }

                            if (tbTwo.sqjcyw.IndexOf("室内环境质量检测") >= 0 ||
                                tbTwo.sqjcyw.IndexOf("建筑附属设备安装工程检测") >= 0)
                            {
                                needSpecialQualify = 1;
                            }
                        }

                        //先删除之前分配的专家
                        repExp.DeleteByCondition(r => r.pid == model.pid);

                        if (!string.IsNullOrEmpty(model.zjsp1))
                        {
                            var ueu = new t_D_UserExpertUnit();
                            ueu.userid  = Convert.ToInt32(model.zjsp1);
                            ueu.pid     = Convert.ToInt32(model.pid);
                            ueu.addtime = DateTime.Now;
                            ueu.status  = 0;
                            ueu.needUnitBuildingQualify = needUnitBuildingQualify;
                            ueu.needSpecialQualify      = needSpecialQualify;

                            db.Insert(ueu, true);
                        }

                        if (!string.IsNullOrEmpty(model.zjsp2))
                        {
                            var ueu = new t_D_UserExpertUnit();
                            ueu.userid  = Convert.ToInt32(model.zjsp2);
                            ueu.pid     = Convert.ToInt32(model.pid);
                            ueu.addtime = DateTime.Now;
                            ueu.status  = 0;
                            ueu.needUnitBuildingQualify = needUnitBuildingQualify;
                            ueu.needSpecialQualify      = needSpecialQualify;

                            db.Insert(ueu, true);
                        }

                        //更新
                        db.UpdateOnly(new t_D_UserTableOne {
                            @static = 3
                        }, p => p.@static, p => p.id == model.pid);
                        db.UpdateOnly(model, r => new
                        {
                            r.zjsp1,
                            r.zjsp2,
                            r.@static
                        }, r => r.id == model.id);

                        dbTrans.Commit();
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        dbTrans.Rollback();
                        errorMsg = ex.Message;
                        return(false);
                    }
                }
            }
        }