//修改拜访赢率 (销售机会ID,赢率,toke)返回(true/false)
        public JsonResult EditCustomerRate(int cid, int num)
        {
            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);
                    }
                    MarketingChanceAccessor.Instance.UpdateRate(cid, num);
                    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);
        }
Example #2
0
//根据用户ID修改用户权限

        public JsonResult UpdateUserRole(int userId, int roleId)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    if (!CheckUserFunction("1301"))
                    {
                        result.Error            = AppError.ERROR_PERMISSION_FORBID;
                        Res.Data                = result;
                        Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                        return(Res);
                    }
                    SysRoleUserAccessor.Instance.UpdateUserRole(userId, roleId);
                    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);
        }
Example #3
0
        public RespResult UpdateBabyAge(int bbage, 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));
                    if (userid > 0)
                    {
                        AdUser user = UserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Ignore);
                        user.BabyBirthday = DateTime.Now.AddYears(0 - bbage);
                        UserAccessor.Instance.Update(user);
                        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);
        }
        /// <summary>
        /// 根据合同编号以及收款序号确认应收款(合同编号,收款序号,token)返回(true/false)
        /// </summary>
        /// <param name="eid"></param>
        /// <returns></returns>
        public JsonResult ConfirmReceived(string contractNo, int rNum)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    if (!CheckUserFunction(16))
                    {
                        result.Error            = AppError.ERROR_PERMISSION_FORBID;
                        Res.Data                = result;
                        Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                        return(Res);
                    }
                    ContractHowtopayAccessor.Instance.UpdateIsReceived(contractNo, rNum, 2);
                    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="pid"></param>
        /// <returns></returns>
        public JsonResult DeleteProduction(int pid)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (!CheckUserFunction("2010"))
                {
                    result.Error            = AppError.ERROR_PERMISSION_FORBID;
                    Res.Data                = result;
                    Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                    return(Res);
                }

                result.Error = ProProductionAccessor.Instance.Delete(pid) ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED;
                //是否需要删除产品入库单
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            Res.Data = result;
            Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(Res);
        }
Example #6
0
        /// <summary>
        /// 根据采购批次确认应付款(采购批次,token)返回(true/false)
        /// </summary>
        /// <param name="eid"></param>
        /// <returns></returns>
        public JsonResult ConfirmPay(string PCode)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    if (!CheckUserFunction("1104"))
                    {
                        result.Error            = AppError.ERROR_PERMISSION_FORBID;
                        Res.Data                = result;
                        Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                        return(Res);
                    }
                    ProProductonDetailAccessor.Instance.UpdateIsPay(PCode, 2);
                    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);
        }
Example #7
0
        public JsonResult DeleteFile(int picId)
        {
            var        Res    = new JsonResult();
            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();
            }
            Res.Data = result;
            Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(Res);
        }
        public async Task Invoke(HttpContext context)
        {
            try
            {
                await Next.Invoke(context);
            }
            catch (Exception ex)
            {
                var setting = new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()  //使用驼峰样式
                };
                var result = new RespResult
                {
                    Status = 400,
                    Msg    = ex.Message
                };
                string body  = JsonConvert.SerializeObject(result, setting);
                byte[] bodys = Encoding.UTF8.GetBytes(body);

                context.Response.StatusCode  = 400;
                context.Response.ContentType = "application/json;charset=utf-8";
                await context.Response.Body.WriteAsync(bodys);
            }
        }
Example #9
0
        //编辑投票结果类型
        public string EditVoteResult(int votid, int min, int max, string re)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
Example #10
0
        //获取单个投票类型的用户投票数
        public string GetVoteNum(int voteTypeID)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
        /// <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))
                {
                    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);
        }
Example #12
0
        //获取投票列表
        public string LoadVoteList(int voteTypeID)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
Example #13
0
        //启用宝贝
        public RespResult OpenBBPost(int bbPostID, string token)
        {
            RespResult result = new RespResult();

            try
            {
                if (!CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
                }
                else
                {
                    ProProduct pro = new ProProduct();
                    pro = ProProductAccessor.Instance.Get(bbPostID);

                    pro.State = 1;
                    ProProductAccessor.Instance.Update(pro);
                    result.Error = AppError.ERROR_SUCCESS;
                }
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #14
0
        //投票,返回投票结果
        public string Vote(int votid, string ip)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
        /// <summary>
        /// 修改一个用户的角色(清除原有角色)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        public JsonResult UpdateUserRoles(int userId, List <int> roleIds)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (!SysRoleAccessor.Instance.DeleteByUserId(userId))
                {
                    result.Error = AppError.ERROR_FAILED;
                }
                else
                {
                    foreach (int roleId in roleIds)
                    {
                        SysRoleUser item = new SysRoleUser();
                        item.UserId = userId;
                        item.RoleId = roleId;
                        item.EntId  = CurrentUser.EntId;
                        SysRoleUserAccessor.Instance.Insert(item);
                    }
                }
                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);
        }
Example #16
0
        /// <summary>
        /// 发送邮件找回密码
        /// </summary>
        /// <param name="EmailBody">邮件内容</param>
        /// <param name="Email">邮件接收收人Email</param>
        /// <returns></returns>
        public JsonResult SendEamilForCallBackPwd(string Email)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            result.Error = AppError.ERROR_SUCCESS;
            string code = GetUserTokenByEmail(Email);

            if (!string.IsNullOrEmpty(code))
            {
                string ResponseUrl   = "http://" + HttpContext.Request.Url.Host + ":" + HttpContext.Request.Url.Port.ToString() + "/www/restpwd.html?token=" + code;
                string emailtemplate = EmailTemplate.GetEmailTemplate(EmailType.ForgotPwd);
                emailtemplate = string.Format(emailtemplate, Email, ResponseUrl);
                string EmailBody = emailtemplate;
                try
                {
                    EmailHelper.SendEamil(EmailBody, Email);
                }
                catch (Exception e)
                {
                    result.Error     = AppError.ERROR_FAILED;
                    result.ExMessage = e.ToString();
                }
            }
            else
            {
                result.Error = AppError.ERROR_FAILED;
            }
            Res.Data = result;
            Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(Res);
        }
Example #17
0
        /// <summary>
        /// 绑定成长记录图片
        /// </summary>
        /// <param name="bookid">成长记录ID</param>
        /// <param name="picid"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public RespResult BindBookPic(int bookid, int picid,string description,DateTime createtime, string token)
        {
            RespResult result = new RespResult();
            try
            {
                if (!CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
                }
                else
                {

                    ResPic pic = ResPicAccessor.Instance.Get(picid);
                    pic.ObjId = bookid;
                    pic.ObjType = PicType.Book;
                    pic.PicDescription = description;
                    pic.CreateTime = createtime;

                    ResPicAccessor.Instance.Update(pic);

                    result.Error = AppError.ERROR_SUCCESS;
                }
            }
            catch (Exception e)
            {
                result.Error = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return result;
        }
        /// <summary>
        /// 修改一个用户的角色(清除原有角色)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        public RespResult UpdateUserRole(int userId, List <int> roleIds)
        {
            RespResult result = new RespResult();

            try
            {
                if (!SysRoleAccessor.Instance.Delete(userId))
                {
                    result.Error = AppError.ERROR_FAILED;
                }
                else
                {
                    foreach (int roleId in roleIds)
                    {
                        SysRoleUser item = new SysRoleUser();
                        item.UserId = userId;
                        item.RoleId = roleId;
                        SysRoleUserAccessor.Instance.Insert(item);
                    }
                }
                result.Error = AppError.ERROR_SUCCESS;
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #19
0
        public RespResult DeleteBook(int bookid, string token)
        {
            RespResult result = new RespResult();

            try
            {
                if (!CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
                }
                else
                {
                    if (ProBookAccessor.Instance.Delete(bookid))
                    {
                        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);
        }
Example #20
0
        /// <summary>
        /// 绑定成长记录图片
        /// </summary>
        /// <param name="bookid">成长记录ID</param>
        /// <param name="picid"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public RespResult BindBookPic(int bookid, int picid, string description, DateTime createtime, string token)
        {
            RespResult result = new RespResult();

            try
            {
                if (!CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
                }
                else
                {
                    ResPic pic = ResPicAccessor.Instance.Get(picid);
                    pic.ObjId          = bookid;
                    pic.ObjType        = PicType.Book;
                    pic.PicDescription = description;
                    pic.CreateTime     = createtime;

                    ResPicAccessor.Instance.Update(pic);

                    result.Error = AppError.ERROR_SUCCESS;
                }
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #21
0
        ////修改宝贝信息
        //public RespResult EditeBBPic(int bbid, int picid, string token)
        //{
        //    RespResult result = new RespResult();
        //    if (!CacheManagerFactory.GetMemoryManager().Contains(token))
        //    {
        //        result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
        //    }
        //    else
        //    {
        //        try
        //        {
        //            ProProduct pro = new ProProduct();
        //            pro = ProProductAccessor.Instance.Get(bbid);

        //            if (picid != pro.PicId)
        //            {
        //                ResPicAccessor.Instance.Delete(pro.PicId);
        //                ResPic pic = ResPicAccessor.Instance.Get(picid);
        //                pic.ObjId = bbid;
        //                ResPicAccessor.Instance.Update(pic);
        //            }

        //            ProProductAccessor.Instance.Update(pro);
        //            result.Error = AppError.ERROR_SUCCESS;
        //        }
        //        catch (Exception e)
        //        {
        //            result.Error = AppError.ERROR_FAILED;
        //            result.ExMessage = e.ToString();
        //        }
        //    }
        //    return result;
        //}
        /// <summary>
        /// 发布单个宝贝图片
        /// </summary>
        /// <param name="postid">宝贝帖子ID</param>
        /// <param name="picid"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public RespResult BindBBPic(int postid, int picid, string token)
        {
            RespResult result = new RespResult();

            try
            {
                if (!CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
                }
                else
                {
                    ResPic pic = ResPicAccessor.Instance.Get(picid);
                    pic.ObjId   = postid;
                    pic.ObjType = PicType.BBPicture;
                    ResPicAccessor.Instance.Update(pic);

                    result.Error = AppError.ERROR_SUCCESS;
                }
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #22
0
        //添加投票分类
        public string AddVoteType(string title, string description)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
Example #23
0
        //获取用户投票现有投票数
        public string GetCurrentVoteNum(string ip)
        {
            RespResult result = new RespResult();


            return(JsonHelper.Serialize(result));
        }
Example #24
0
        /// <summary>
        /// 管理员修改所管理企业CODE
        /// </summary>
        /// <param name="username"></param>
        /// <param name="entCode"></param>
        /// <returns></returns>
        public JsonResult AdminEditEntCode(string entCode, 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 entUser = new SysUser();
                        if (!string.IsNullOrEmpty(entCode.Trim()))
                        {
                            entUser = SysUserAccessor.Instance.GetEntUserByEntCode(entCode.Trim());
                            if (entUser != null)
                            {
                                result.Error            = AppError.ERROR_ENTCODE_EXIST;
                                Res.Data                = result;
                                Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                                return(Res);
                            }
                        }

                        SysUser olduser = SysUserAccessor.Instance.Get(entId);
                        //olduser.EntCode = entUser.EntCode;
                        olduser.EntCode = entCode;

                        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);
        }
Example #25
0
        //关联企业
        public JsonResult EditeUserEntCode(string username, string entCode)
        {
            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 entUser = new SysUser();
                        if (!string.IsNullOrEmpty(entCode.Trim()))
                        {
                            entUser = SysUserAccessor.Instance.GetEntUserByEntCode(entCode.Trim());
                            if (entUser == null)
                            {
                                result.Error            = AppError.ERROR_PERSON_NOT_FOUND;
                                Res.Data                = result;
                                Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                                return(Res);
                            }
                        }

                        SysUser olduser = SysUserAccessor.Instance.Get(userid);
                        olduser.EntId    = entUser.EntId;
                        olduser.EntCode  = entUser.EntCode;
                        olduser.UserName = username;

                        SysUserAccessor.Instance.Update(olduser);
                        result.Error = AppError.ERROR_SUCCESS;
                        AddUserTimeMachine(userid, 3, 0);
                    }
                    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);
        }
Example #26
0
        ////获取宝贝通过宝贝ID
        //public AdvancedResult<ProProduct> GetBBInfoByBBid(int bbid)
        //{
        //    AdvancedResult<ProProduct> result = new AdvancedResult<ProProduct>();
        //    try
        //    {
        //        ProProduct bb = new ProProduct();
        //        bb = ProProductAccessor.Instance.Get(bbid);
        //        result.Data = bb;
        //        result.Error = AppError.ERROR_SUCCESS;
        //    }
        //    catch (Exception e)
        //    {
        //        result.Error = AppError.ERROR_FAILED;
        //        result.ExMessage = e.ToString();
        //    }
        //    return result;
        //}

        //编辑宝贝帖子信息
        public RespResult EditBBPostInfo(int bbPostID, string title, string qq, string mobile, string bbinfo, bool iswash, double price, int age, ItemType bbType, ItemSort bbSort, SexType sex, 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));

                    if (!string.IsNullOrEmpty(qq) || !string.IsNullOrEmpty(mobile))
                    {
                        AdUser user = UserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Active);
                        if (!string.IsNullOrEmpty(qq))
                        {
                            user.Qq = qq;
                        }
                        if (!string.IsNullOrEmpty(mobile))
                        {
                            user.Mobile = mobile;
                        }
                        UserAccessor.Instance.Update(user);
                    }

                    ProProduct pro = new ProProduct();
                    pro          = ProProductAccessor.Instance.Get(bbPostID);
                    pro.Title    = title.Trim();
                    pro.BbInfo   = bbinfo;
                    pro.IsWash   = iswash;
                    pro.Price    = price;
                    pro.MinAge   = (age - 1) < 0 ? 0 : (age - 1);
                    pro.MaxAge   = age + 1;
                    pro.ItemType = bbType;
                    pro.ItemSort = bbSort;
                    pro.Sex      = sex;


                    ProProductAccessor.Instance.Update(pro);
                    result.Error = AppError.ERROR_SUCCESS;
                }
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #27
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="user">修改用户名,性别,密码,地址,qq,手机</param>
        /// <param name="token"></param>
        /// <returns></returns>
        public RespResult EditeUserInfo(AdUser user, 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));
                    if (userid > 0)
                    {
                        AdUser olduser = UserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Ignore);
                        if (olduser.UserAccount != user.UserAccount)
                        {
                            AdvancedResult <bool> dr = CheckAccout(user.UserAccount);
                            if (dr.Data)
                            {
                                result.Error = AppError.ERROR_PERSON_FOUND;
                                return(result);
                            }
                        }
                        olduser.UserAccount = user.UserAccount;
                        olduser.Sex         = user.Sex;
                        olduser.Pwd         = user.Pwd;
                        olduser.Province    = user.Province;
                        olduser.City        = user.City;
                        olduser.County      = user.County;
                        olduser.Street      = user.Street;
                        olduser.Mobile      = user.Mobile;
                        olduser.Qq          = user.Qq;

                        UserAccessor.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();
            }
            return(result);
        }
 /// <summary>
 /// 添加入库单
 /// </summary>
 /// <param name="ppd"></param>
 /// <returns></returns>
 public RespResult AddProductonDetail(ProProductonDetail ppd)
 {
     RespResult result = new RespResult();
     try
     {
         result.Error = ProProductonDetailAccessor.Instance.Insert(ppd) ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED;
     }
     catch (Exception e)
     {
         result.Error = AppError.ERROR_FAILED;
         result.ExMessage = e.ToString();
     }
     return result;
 }
Example #29
0
        //针对单个销售机会拜访客户(销售机会ID,拜访方式,拜访描述,报价,地点,token)
        //返回(True/false)注:如果是第一次则需修改机会表字段为已拜访
        public JsonResult ToVisit(int cid, int visitType, string remark, Double amount, String address)
        {
            var        Res    = new JsonResult();
            RespResult result = new RespResult();

            try
            {
                if (CacheManagerFactory.GetMemoryManager().Contains(token))
                {
                    if (!CheckUserFunction(21))
                    {
                        result.Error            = AppError.ERROR_PERMISSION_FORBID;
                        Res.Data                = result;
                        Res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                        return(Res);
                    }
                    MarketingVisit mv = new MarketingVisit();
                    mv.Address   = address;
                    mv.Amount    = amount;
                    mv.ChanceId  = cid;
                    mv.Remark    = remark;
                    mv.VisitTime = DateTime.Now;
                    mv.VisitType = visitType;
                    mv.EntId     = CurrentUser.EntId;
                    int i = MarketingVisitAccessor.Instance.Insert(mv);

                    if (i > 0)
                    {
                        MarketingChanceAccessor.Instance.UpdateisVisit(cid, 2);
                        result.Error = AppError.ERROR_SUCCESS;
                    }
                    else
                    {
                        result.Error = 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>
        /// 判断用户是否有此页面权限(暂未实现)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="functionCode"></param>
        /// <returns></returns>
        public RespResult CheckUserFunction(int userId, string functionCode)
        {
            RespResult result = new RespResult();
            try
            {

                result.Error = AppError.ERROR_SUCCESS;
            }
            catch (Exception e)
            {
                result.Error = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return result;
        }
        /// <summary>
        /// 添加入库单
        /// </summary>
        /// <param name="ppd"></param>
        /// <returns></returns>
        public RespResult AddProductonDetail(ProProductonDetail ppd)
        {
            RespResult result = new RespResult();

            try
            {
                result.Error = ProProductonDetailAccessor.Instance.Insert(ppd) ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED;
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
        /// <summary>
        /// 删除产品
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public RespResult DeleteProduction(int pid)
        {
            RespResult result = new RespResult();

            try
            {
                result.Error = ProProductionAccessor.Instance.Delete(pid) ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED;
            }
            catch (Exception e)
            {
                result.Error     = AppError.ERROR_FAILED;
                result.ExMessage = e.ToString();
            }
            return(result);
        }
Example #33
0
        private static async Task HandleExceptionAsync(HttpContext context, int statusCode, string msg)
        {
            var data   = new RespResult(statusCode, msg);
            var result = JsonConvert.SerializeObject(data);

            if (context.Response?.ContentType?.ToLower() == "application/xml")
            {
                await context.Response.WriteAsync(XmlConvert.Object2XmlString(data)).ConfigureAwait(false);
            }
            else
            {
                context.Response.ContentType = "application/json;charset=utf-8";
                await context.Response.WriteAsync(result).ConfigureAwait(false);
            }
        }
 /// <summary>
 /// 添加用户到某个角色(不删除原有角色)
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="roleIds"></param>
 /// <returns></returns>
 public RespResult AddRolesToUser(int userId, List<int> roleIds)
 {
     RespResult result = new RespResult();
     try
     {
         foreach (int roleId in roleIds)
         {
             SysRoleUser item = new SysRoleUser();
             item.UserId = userId;
             item.RoleId = roleId;
             SysRoleUserAccessor.Instance.Insert(item);
         }
         result.Error = AppError.ERROR_SUCCESS;
     }
     catch (Exception e)
     {
         result.Error = AppError.ERROR_FAILED;
         result.ExMessage = e.ToString();
     }
     return result;
 }
 /// <summary>
 /// 移除用户角色
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="roleIds"></param>
 /// <returns></returns>
 public RespResult RemoveUserRole(int userId, List<int> roleIds)
 {
     RespResult result = new RespResult();
     try
     {
         foreach (int roleId in roleIds)
         {
             SysRoleUserAccessor.Instance.Delete(userId,roleId);
         }
         result.Error = AppError.ERROR_SUCCESS;
     }
     catch (Exception e)
     {
         result.Error = AppError.ERROR_FAILED;
         result.ExMessage = e.ToString();
     }
     return result;
 }
Example #36
0
 public RespResult DeleteBook(int bookid, string token)
 {
     RespResult result = new RespResult();
     try
     {
         if (!CacheManagerFactory.GetMemoryManager().Contains(token))
         {
             result.Error = AppError.ERROR_PERSON_NOT_LOGIN;
         }
         else
         {
             if (ProBookAccessor.Instance.Delete(bookid))
             {
                 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;
 }
Example #37
0
        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>
 /// 删除产品
 /// </summary>
 /// <param name="pid"></param>
 /// <returns></returns>
 public RespResult DeleteProduction(int pid)
 {
     RespResult result = new RespResult();
     try
     {
         result.Error = ProProductionAccessor.Instance.Delete(pid) ? AppError.ERROR_SUCCESS : AppError.ERROR_FAILED;
     }
     catch (Exception e)
     {
         result.Error = AppError.ERROR_FAILED;
         result.ExMessage = e.ToString();
     }
     return result;
 }
        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;
        }
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="user">修改用户名,性别,密码,地址,qq,手机</param>
        /// <param name="token"></param>
        /// <returns></returns>
        public RespResult EditeUserInfo(SysUser user, 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));
                    if (userid > 0)
                    {
                        //SysUser olduser = SysUserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Ignore);
                        //if (olduser.UserAccount != user.UserAccount)
                        //{
                        //    AdvancedResult<bool> dr = CheckAccout(user.UserAccount);
                        //    if (dr.Data)
                        //    {
                        //        result.Error = AppError.ERROR_PERSON_FOUND;
                        //        return result;
                        //    }
                        //}
                        //olduser.UserAccount = user.UserAccount;
                        //olduser.Sex = user.Sex;
                        //olduser.Pwd = user.Pwd;
                        //olduser.Province = user.Province;
                        //olduser.City = user.City;
                        //olduser.County = user.County;
                        //olduser.Street = user.Street;
                        //olduser.Mobile = user.Mobile;
                        //olduser.Qq = user.Qq;

                        //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();
            }
            return result;
        }