private string GetUserTokenByEmail(string email) { string token = string.Empty; try { SysUser user = SysUserAccessor.Instance.GetSysUserByAcount(email); token = SecurityHelper.GetToken(user.UserId.ToString()); CacheManagerFactory.GetMemoryManager().Set(token, user.UserId.ToString(), new TimeSpan(0, 30, 0)); } catch (Exception e) { } return(token); }
/// <summary> /// 员工注册 /// </summary> /// <param name="account">员工账号是邮箱格式</param> /// <param name="pwd"></param> /// <returns></returns> public JsonResult UserRegister(string username, string account, string pwd, int entId) { var Res = new JsonResult(); AdvancedResult <string> result = new AdvancedResult <string>(); try { AdvancedResult <bool> dr = CheckUserAccout(account); if (dr.Data) { result.Error = AppError.ERROR_PERSON_FOUND; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } SysUser user = new SysUser(); user.UserAccount = account; user.UserName = username; user.Pwd = SecurityHelper.MD5(pwd); user.Email = account; user.EntId = entId; user.CreateTime = DateTime.Now; user.EndTime = DateTime.Now.AddDays(90); user.IsEnable = 1; user.Type = 1; int i = SysUserAccessor.Instance.Insert(user); if (i > 0) { string token = SecurityHelper.GetToken(i.ToString()); CacheManagerFactory.GetMemoryManager().Set(token, i.ToString()); result.Error = AppError.ERROR_SUCCESS; result.Data = token; WriteAuthCookie(user.UserName, token); } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
//编辑销售机会详情(机会ID,机会类型,客户类型,机会描述,联系人,联系方式,token) 返回(true/false) public JsonResult EditMarketingInfo(int cid, int chanceType, int customerType, string username, string chanceDetail, string tel, string phone, string email, string qq) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction("1202")) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } MarketingChance chance = new MarketingChance(); chance = MarketingChanceAccessor.Instance.Get(cid); chance.ChanceType = chanceType; chance.ContactName = username; chance.CustomerType = customerType; chance.Email = email; chance.Phone = phone; chance.Qq = qq; chance.Remark = chanceDetail; chance.Tel = tel; MarketingChanceAccessor.Instance.Update(chance); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
public JsonResult AdminEditEntName(string entName, int entId) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { if (!CheckUserFunction(25)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); if (userid > 0) { SysUser olduser = SysUserAccessor.Instance.Get(entId); //olduser.EntCode = entUser.EntCode; olduser.UserName = entName; SysUserAccessor.Instance.Update(olduser); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_FAILED; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> ///添加产品 /// </summary> /// <param name="pro"></param> /// <returns></returns> public JsonResult AddProduction(string pname, int ptypeid, string unit, string pinfo, Double LowestPrice, Double MarketPrice) { var Res = new JsonResult(); RespResult result = new RespResult(); ProProduction pro = new ProProduction(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction("2010")) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } pro.PName = pname; pro.PInfo = pinfo; pro.PTypeId = ptypeid; pro.Unit = unit; pro.LowestPrice = LowestPrice; pro.MarketPrice = MarketPrice; pro.EntId = CurrentUser.EntId; pro.UserId = CurrentUser.UserId; //pro.StockCount 需要在添加入库单的时候更新 result.Id = ProProductionAccessor.Instance.Insert(pro); result.Error = result.Id > 0 ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
//根据合同编号获取合同信息(合同编号,token)返回(合同名称,合同编号,客户名称,合同金额,付款方式(xml),合同有效期,合同承办人,合同时间,附件{附件url1,附件url2}) public JsonResult GetContractInfoByContractNo(string contractNo) { var Res = new JsonResult(); AdvancedResult <ContractInfo> result = new AdvancedResult <ContractInfo>(); if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(23)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } // int ownerid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); try { ContractInfo con = new ContractInfo(); con = ContractInfoAccessor.Instance.Get(contractNo); con.HowtopayList = ContractHowtopayAccessor.Instance.Search(contractNo, 0); con.Chance = MarketingChanceAccessor.Instance.Get(con.ChanceId); result.Error = AppError.ERROR_SUCCESS; result.Data = con; } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 获取当前用户信息 /// </summary> /// <param name="token"></param> /// <returns></returns> public JsonResult GetUserInfo() { var Res = new JsonResult(); AdvancedResult <SysUser> result = new AdvancedResult <SysUser>(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); if (userid > 0) { SysUser user = SysUserAccessor.Instance.Get(userid); if (user.IsEnable == 2) { result.Error = AppError.ERROR_USER_FORBID; } else { result.Error = AppError.ERROR_SUCCESS; result.Data = user; } } else { result.Error = AppError.ERROR_FAILED; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
public RespResult Logout(string token) { RespResult result = new RespResult(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { CacheManagerFactory.GetMemoryManager().Remove(token); } result.Error = AppError.ERROR_SUCCESS; } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public AdvancedResult <int> AddBook(string bookname, BookSize booksize, BookCoverType bookcover, int booktype, string introduction, string token) { AdvancedResult <int> result = new AdvancedResult <int>(); try { if (string.IsNullOrEmpty(bookname)) { result.Error = AppError.ERROR_BOOK_NOT_NULL; return(result); } if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); //int userid = 5; ProBook book = new ProBook(); book.BookName = bookname.Trim(); book.BookSize = booksize; book.BookType = booktype; book.AdUserId = userid; book.BookCover = bookcover; book.Introduction = string.IsNullOrEmpty(introduction) ? string.Empty : introduction.Trim(); result.Data = ProBookAccessor.Instance.Insert(book); result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public AdvancedResult <ResPic> UploadUserImage(byte[] fileByte, int picHeight, int picWidth, string token) { AdvancedResult <ResPic> result = new AdvancedResult <ResPic>(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); string fileUrl = string.Empty; fileUrl = FileHelper.UploadFile(userid, fileByte, "jpg", PicType.UserHeadImg); AdUser user = UserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Ignore); ResPic pic = new ResPic(); pic.ObjId = userid; pic.ObjType = PicType.UserHeadImg; pic.PicUrl = fileUrl; pic.PicHeight = picHeight; pic.PicWidth = picWidth; pic.State = StateType.Active; if (user.PicId > 0) { ResPicAccessor.Instance.Delete(user.PicId); } int picid = ResPicAccessor.Instance.Insert(pic); result.Data = pic; result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
// // GET: /CustomerManagement/Customer/ /// <summary> /// 通过销售人员ID获取销售的企业客户 /// </summary> /// <param name="ownerid"></param> /// <returns></returns> public JsonResult SearchCustomerEntByOwnerId(int pageIndex, int pageSize) { var Res = new JsonResult(); AdvancedResult <PageEntity <CustomerEnt> > result = new AdvancedResult <PageEntity <CustomerEnt> >(); if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(7)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } int ownerid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); try { PageEntity <CustomerEnt> list = new PageEntity <CustomerEnt>(); list = CustomerEntAccessor.Instance.SearchCustomerEntByOwnerId(ownerid, pageIndex, pageSize); result.Error = AppError.ERROR_SUCCESS; result.Data = list; } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 修改用户邮箱 /// </summary> /// <param name="email"></param> /// <param name="pwd"></param> /// <returns></returns> public JsonResult UpdateEmail(string email, string pwd) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { SysUser olduser = SysUserAccessor.Instance.Get(CurrentUser.UserId); if (SecurityHelper.MD5(pwd) != olduser.Pwd) { result.Error = AppError.ERROR_FAILED; } else if (!CheckUserAccout(email).Data) { result.Error = AppError.ERROR_FAILED; } else { olduser.Email = email; SysUserAccessor.Instance.Update(olduser); result.Error = AppError.ERROR_SUCCESS; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> ///添加产品分类 /// </summary> /// <param name="ptype"></param> /// <returns></returns> public JsonResult AddProductionType(int fatherid, String pTypeName, int ptypepicid) { var Res = new JsonResult(); RespResult result = new RespResult(); ProProductionType ptype = new ProProductionType(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(2)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } ptype.EntId = CurrentUser.EntId; ptype.PicId = ptypepicid; ptype.PTypeName = pTypeName; ptype.FatherId = fatherid; result.Id = ProProductionTypeAccessor.Instance.Insert(ptype); result.Error = result.Id > 0 ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 根据企业ID获取应付款列表 (token)返回 应付款列表(采购批次,单价,数量,提交时间,付款状态) /// </summary> /// <param name="eid"></param> /// <returns></returns> public JsonResult SearchPayablesByEID(int pageIndex, int pageSize) { var Res = new JsonResult(); AdvancedResult <PageEntity <ProProductonDetail> > result = new AdvancedResult <PageEntity <ProProductonDetail> >(); PageEntity <ProProductonDetail> rmlist = new PageEntity <ProProductonDetail>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(13)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); SysUser user = SysUserAccessor.Instance.Get(userid); //获取应付款列表 rmlist = ProProductonDetailAccessor.Instance.Search(0, 0, user.EntId, pageIndex, pageSize, 0); result.Error = AppError.ERROR_SUCCESS; result.Data = rmlist; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
private void AddActionlog(string actionname, string prams, string result, ControllerContext filterContext) { int userid = 0; if (filterContext.Controller is Controllers.MicControllerBase) { Controllers.MicControllerBase controller = filterContext.Controller as Controllers.MicControllerBase; if (controller.token != null) { userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(controller.token)); } } SysLog log = new SysLog(); log.Action = actionname; log.AddTime = DateTime.Now; log.Parameter = prams; log.UserId = userid; log.Result = result; SysLogAccessor.Instance.Insert(log); }
//编辑拜访记录(拜访记录ID,拜访方式,拜访描述,报价,地点)返回(true/false) public JsonResult EditVisitInfo(int vid, int visitType, string remark, Double amount, String address) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction("1204")) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } MarketingVisit mv = MarketingVisitAccessor.Instance.Get(vid); mv.Address = address; mv.Amount = amount; mv.IdmarketingVisit = vid; mv.Remark = remark; mv.VisitType = visitType; MarketingVisitAccessor.Instance.Update(mv); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 回复心愿贴 /// </summary> /// <param name="blessID"></param> /// <param name="refReplyID"></param> /// <param name="Content"></param> /// <param name="token"></param> /// <returns></returns> public RespResult ReplyBless(int blessID, int refReplyID, string Content, string token) { RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); GenBless bless = GetBless(blessID).Data; if (bless != null) { GenReply reply = new GenReply(); reply.ObjId = blessID; reply.ObjType = (int)ReplyType.Bless; reply.Content = Content; reply.CreateId = userid; reply.RefUserId = bless.CreateId; reply.RefReplyId = refReplyID; GenReplyAccessor.Instance.Insert(reply); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_FAILED; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public RespResult EditBook(int bookid, string bookname, BookSize booksize, BookCoverType bookcover, int booktype, string introduction, string token) { RespResult result = new RespResult(); try { if (string.IsNullOrEmpty(bookname)) { result.Error = AppError.ERROR_BOOK_NOT_NULL; return(result); } if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { ProBook book = new ProBook(); book.BookId = bookid; book.BookName = bookname.Trim(); book.BookSize = booksize; book.BookType = booktype; book.BookCover = bookcover; book.Introduction = string.IsNullOrEmpty(introduction) ? string.Empty : introduction.Trim(); book.State = StateType.Active; ProBookAccessor.Instance.Update(book); result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
/// <summary> /// 根据企业ID获取分类列表 /// </summary> /// <param name="entid"></param> /// <returns></returns> public JsonResult SearchProductTypeListByEntID(int pageIndex, int pageSize) { var Res = new JsonResult(); AdvancedResult <List <ProductTypeModule> > result = new AdvancedResult <List <ProductTypeModule> >(); List <ProductTypeModule> ptlist = new List <ProductTypeModule>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { PageEntity <ProProductionType> list = new PageEntity <ProProductionType>(); list = ProProductionTypeAccessor.Instance.Search(0, string.Empty, CurrentUser.EntId, 0, pageIndex, pageSize); for (int i = 0; i < list.Items.Count; i++) { ProductTypeModule pt = new ProductTypeModule(); pt.EntId = list.Items[i].EntId; pt.PTypeId = list.Items[i].PTypeId; pt.PTypeName = list.Items[i].PTypeName; pt.FatherId = list.Items[i].FatherId; pt.PicUrl = ResPicAccessor.Instance.Get(list.Items[0].PicId).PicUrl; ptlist.Add(pt); } result.Error = AppError.ERROR_SUCCESS; result.Data = ptlist; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
//关联用户头像 public JsonResult EditeUserHeadImg(int picid) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); if (userid > 0) { SysUser olduser = SysUserAccessor.Instance.Get(userid); olduser.PicId = picid; SysUserAccessor.Instance.Update(olduser); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_FAILED; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
public JsonResult Login(string account, string pwd) { var Res = new JsonResult(); AdvancedResult <string> result = new AdvancedResult <string>(); try { SysUser user = null; user = SysUserAccessor.Instance.GetSysUserByAcountAndPwd(account.Trim(), SecurityHelper.MD5(pwd.Trim())); if (user != null) { if (user.IsEnable == 2) { result.Error = AppError.ERROR_USER_FORBID; } else { string token = SecurityHelper.GetToken(user.UserId.ToString()); CacheManagerFactory.GetMemoryManager().Set(token, user.UserId); result.Error = AppError.ERROR_SUCCESS; result.Data = token; WriteAuthCookie(user.UserName, token); } } else { result.Error = AppError.ERROR_LOGIN_FAILED; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
public AdvancedResult <bool> CheckLogin(string token) { AdvancedResult <bool> result = new AdvancedResult <bool>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Data = true; result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public RespResult DeleteBBPic(int picId, string token) { RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { ResPicAccessor.Instance.Delete(picId); result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public JsonResult Logout() { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { CacheManagerFactory.GetMemoryManager().Remove(token); } result.Error = AppError.ERROR_SUCCESS; } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 登录后绑定 /// </summary> /// <param name="token"></param> /// <param name="socialUser"></param> /// <returns></returns> public AdvancedResult <string> BindSocialUserAfterLogin(string token, SocialUser socialUser) { AdvancedResult <string> result = new AdvancedResult <string>(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { SocialUserAccessor.Instance.Insert(socialUser); result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
//---------------员工管理----------------- // 通过token获取企业所有权限 返回 权限列表(权限ID,全部(人数)) public JsonResult SearchEntRole() { var Res = new JsonResult(); AdvancedResult <List <SysRole> > result = new AdvancedResult <List <SysRole> >(); List <SysRole> rolelist = new List <SysRole>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(26)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } rolelist = SysRoleAccessor.Instance.LoadEntRole(CurrentUser.EntId); rolelist.Single(o => o.RoleId == 0).Count = rolelist.Single(o => o.RoleId == 0).Count + rolelist.Single(o => o.RoleId == -1).Count; result.Error = AppError.ERROR_SUCCESS; result.Data = rolelist; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
public JsonResult UpdateNewPwd(string userToken, string newPwd) { var Res = new JsonResult(); RespResult result = new RespResult(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(userToken)) { result.Error = AppError.ERROR_FAILED; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(userToken)); if (userid > 0) { SysUser olduser = SysUserAccessor.Instance.Get(userid); olduser.Pwd = SecurityHelper.MD5(newPwd); SysUserAccessor.Instance.Update(olduser); result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_FAILED; } } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
//获取单个销售机会的拜访记录(销售机会ID,toke)返回 拜访列表(拜访方式,拜访描述,报价,地点),赢率 public JsonResult GetVisitInfo(int cid, int pageIndex, int pageSize) { var Res = new JsonResult(); AdvancedResult <SingleVisitListModel> result = new AdvancedResult <SingleVisitListModel>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction("1205")) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } PageEntity <MarketingVisit> returnValue = new PageEntity <MarketingVisit>(); result.Data = new SingleVisitListModel(); result.Data.Vlist = MarketingVisitAccessor.Instance.Search(cid, pageIndex, pageSize); result.Data.Rate = MarketingChanceAccessor.Instance.Get(cid).Rate; result.Error = AppError.ERROR_SUCCESS; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
/// <summary> /// 通过权限ID获取用户信息 返回 用户列表(账号,姓名,sex,头像,手机号,入职时间,权限ID) /// </summary> /// <param name="roleId">0获取全部,-1 获取未审核用户</param> /// <returns></returns> public JsonResult SearchUserListByRoleId(int roleId) { var Res = new JsonResult(); AdvancedResult <List <SysUser> > result = new AdvancedResult <List <SysUser> >(); List <SysUser> userlist = new List <SysUser>(); try { if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(26)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } userlist = SysUserAccessor.Instance.LoadSysUserByRoleId(CurrentUser.EntId, roleId); result.Error = AppError.ERROR_SUCCESS; result.Data = userlist; } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }
//根据联系人名称查询个人客户(联系人名称,token)返回(联系方式,个人信息) public JsonResult SearchCustomerPrivateByName(string name) { var Res = new JsonResult(); AdvancedResult <List <CustomerPrivate> > result = new AdvancedResult <List <CustomerPrivate> >(); if (CacheManagerFactory.GetMemoryManager().Contains(token)) { if (!CheckUserFunction(8)) { result.Error = AppError.ERROR_PERMISSION_FORBID; Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); } try { List <CustomerPrivate> list = new List <CustomerPrivate>(); list = CustomerPrivateAccessor.Instance.SearchCustomerPrivByName(name); result.Error = AppError.ERROR_SUCCESS; result.Data = list; } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } } else { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } Res.Data = result; Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Res); }