Example #1
0
        public IHttpActionResult CheckForumLike(int UID, int ForumID)
        {
            WebApi_BLL.T_Forum_Likes          bll  = new WebApi_BLL.T_Forum_Likes();
            List <WebApi_Model.T_Forum_Likes> list = bll.GetModelList("UID=" + UID + " and ForumID=" + ForumID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(list))));
        }
Example #2
0
        public IHttpActionResult AddCustomer()
        {
            string name = requestHelper.GetRequsetForm("customerName", "");
            string tel  = requestHelper.GetRequsetForm("tel", "");

            if (string.IsNullOrEmpty(name))
            {
                return(Ok(ReturnJsonResult.ToJson(-1, "客户名称不能为空!", "")));
            }
            if (string.IsNullOrEmpty(tel))
            {
                return(Ok(ReturnJsonResult.ToJson(-1, "联系电话不能为空!", "")));
            }
            Model.Customers model = new Model.Customers();
            model.CustomerName = name;
            model.Tel          = tel;
            int i = bll.Add(model);

            if (i > 0)
            {
                return(Ok(ReturnJsonResult.ToJson(1, "添加成功!", "")));
            }

            return(Ok(ReturnJsonResult.ToJson(-1, "添加失败!", "")));
        }
Example #3
0
 public IHttpActionResult ClickLikes()
 {
     try
     {
         int UID = int.Parse(requestHelper.GetRequsetForm("UID", ""));
         int PhotoCollectionID            = int.Parse(requestHelper.GetRequsetForm("PhotoCollectionID", ""));
         WebApi_BLL.T_Photo_Likes tpl_bll = new WebApi_BLL.T_Photo_Likes();
         if (tpl_bll.Exists(UID, PhotoCollectionID))
         {
             tpl_bll.Delete(UID, PhotoCollectionID);
             return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", "-1")));
         }
         else
         {
             WebApi_Model.T_Photo_Likes model = new WebApi_Model.T_Photo_Likes();
             model.UID = UID;
             model.PhotoCollectionID = PhotoCollectionID;
             tpl_bll.Add(model);
             return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", "+1")));
         }
     }
     catch (Exception ex) {
         return(Ok(ReturnJsonResult.GetJsonResult(1, "Error", ex.Message)));
     }
 }
Example #4
0
        public IHttpActionResult GetForumsActivity()
        {
            WebApi_BLL.T_Forum_Activity          bll   = new WebApi_BLL.T_Forum_Activity();
            List <WebApi_Model.T_Forum_Activity> model = bll.GetModelList("");

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(model))));
        }
Example #5
0
        public IHttpActionResult UserRegister(dynamic model)
        {
            T_User user = (T_User)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(T_User));

            if (string.IsNullOrEmpty(user.Tel))
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "电话号码不能为空!", "")));
            }

            //if (!System.Text.RegularExpressions.Regex.IsMatch(user.Tel, @"^[1]+[3,5]+\d{9}"))
            //{
            //    return Ok(ReturnJsonResult.GetJsonResult(-1, "请输入正确的手机号!", ""));
            //}

            if (string.IsNullOrEmpty(user.Password))
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "密码不能为空!", "")));
            }

            int uid = bll.Add(user);

            user.UID = uid;

            if (user.UID.ToString() != "")
            {
                return(Ok(ReturnJsonResult.GetJsonResult(1, "注册成功!", JsonConvert.SerializeObject(user))));
            }
            else
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "注册失败!", JsonConvert.SerializeObject(user))));
            }
        }
Example #6
0
        public IHttpActionResult ConvertWish()
        {
            WebApi_BLL.T_Wish bll     = new WebApi_BLL.T_Wish();
            WebApi_BLL.T_User userbll = new WebApi_BLL.T_User();
            int UID    = Convert.ToInt32(requestHelper.GetRequsetForm("UID", ""));
            int WishID = Convert.ToInt32(requestHelper.GetRequsetForm("UID", ""));

            WebApi_Model.T_Wish wishmodel = bll.GetModel(WishID);
            WebApi_Model.T_User usermodel = userbll.GetModel(UID);

            if (wishmodel == null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", "心愿计划无法找到")));
            }
            if (usermodel == null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", "没有找到用户")));
            }

            if (wishmodel.Status == 1 && usermodel.TuiMao >= wishmodel.TuiMao)
            {
                wishmodel.Status = 2;
                bll.Update(wishmodel);
                usermodel.TuiMao = usermodel.TuiMao - wishmodel.TuiMao;
                userbll.Update(usermodel);

                return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(bll.GetModelList(" UID = " + UID)))));
            }
            else
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", "无法兑换")));
            }
        }
Example #7
0
        public IHttpActionResult GetMessageByUID(int UID)
        {
            WebApi_BLL.T_System_Messages          tsmbll = new WebApi_BLL.T_System_Messages();
            List <WebApi_Model.T_System_Messages> list   = tsmbll.GetModelList("IsDelete = 0 and ToUID =" + UID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(list))));
        }
Example #8
0
 public IHttpActionResult TestUploadCostPhoto()
 {
     try
     {
         int Height = Convert.ToInt32(requestHelper.GetRequsetForm("Height", ""));
         int Weight = Convert.ToInt32(requestHelper.GetRequsetForm("Weight", ""));
         WebApi_BLL.T_Forum_Photo bll = new WebApi_BLL.T_Forum_Photo();
         string Path = HttpContext.Current.Server.MapPath("/Content/User_Photo/");
         //HttpPostedFile file = HttpContext.Current.Request.Files[0];
         //if(file.ContentLength >)
         //string fileExtName = file.FileName.Substring(file.FileName.LastIndexOf("."));
         //string newName = Guid.NewGuid().ToString() + fileExtName;
         //string savePath = Path + newName;
         //file.SaveAs(savePath);
         //WebApi_Model.T_Forum_Photo model = new WebApi_Model.T_Forum_Photo();
         //model.Photo = newName;
         //model.UploadTime = DateTime.Now;
         //model.Height = Height;
         //model.Weight = Weight;
         //int key = bll.Add(model);
         //model.ForumPhotoID = key;
         return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject("Weight:" + Weight + " Height:" + Height + " Length:"))));
     }
     catch (SystemException ex)
     {
         return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", ex.Message)));
     }
 }
Example #9
0
        public IHttpActionResult Logoff()
        {
            int UID = int.Parse(requestHelper.GetRequsetForm("UID", ""));

            bll.LogOff(UID);
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", "")));
        }
Example #10
0
        public IHttpActionResult PostNewFourm(dynamic model)
        {
            try
            {
                WebApi_BLL.T_Forums   bll   = new WebApi_BLL.T_Forums();
                WebApi_Model.T_Forums forum = (WebApi_Model.T_Forums)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(WebApi_Model.T_Forums));
                if (forum.TuiMao != 0 && forum.Forum_Photo.Count == 0)
                {
                    return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject("图集为空"))));
                }
                forum.Status       = 0;
                forum.Flag         = 0;
                forum.PostTime     = DateTime.Now;
                forum.Views        = 0;
                forum.Likes        = 0;
                forum.CommentCount = 0;

                int key = bll.Add(forum);
                forum.ForumID = key;
                return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(forum))));
            }
            catch (Exception ex)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(ex.Message))));
            }
        }
Example #11
0
        public IHttpActionResult GetUserShopCar(int UID)
        {
            WebApi_BLL.T_User_ShopCar shopCar_bll = new WebApi_BLL.T_User_ShopCar();
            List <T_User_ShopCar>     shopCarList = shopCar_bll.GetModelList("UID = " + UID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(shopCarList))));
        }
Example #12
0
        public IHttpActionResult GetProductList()
        {
            int    Page      = int.Parse(requestHelper.GetRequsetForm("Page", ""));
            string strWhere  = requestHelper.GetRequsetForm("strWhere", "");
            string strOrder  = requestHelper.GetRequsetForm("strOrder", "");
            int    TotalPage = 0;
            int    PageSize  = 10;

            if (string.IsNullOrEmpty(strWhere))
            {
                strWhere = " 1 = 1";
            }

            if (string.IsNullOrEmpty(strOrder))
            {
                strOrder = " ProductID desc";
            }

            List <WebApi_Model.T_Product> list = bll.DataTableToList(DBHelper.GetListByPage("T_Product", Page, PageSize, strWhere, strOrder, out TotalPage).Tables[0]);

            //List<WebApi_Model.T_Product> list = bll.DataTableToList(bll.GetListByPage(Page, PageSize, strWhere, strOrder, out TotalPage).Tables[0]);
            //list.Find(

            if (list != null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(1, TotalPage.ToString(), JsonConvert.SerializeObject(list))));
            }
            else
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "OK", "")));
            }
        }
Example #13
0
        public IHttpActionResult ResetPassword()
        {
            try
            {
                string strTel     = requestHelper.GetRequsetForm("Tel", "");
                string strCode    = requestHelper.GetRequsetForm("Code", "");
                string newPasswod = requestHelper.GetRequsetForm("Password", "");
                int    CodeID     = int.Parse(requestHelper.GetRequsetForm("CodeID", ""));

                T_User_SMSCode codeModel = bllsmscode.GetModel(CodeID);
                //DataSet ds = bllsmscode.GetList(" Tel = '" + strTel + "' and Code = '" + strCode + "' and Active = 0 and Type = 2 and OverDueTime >= '" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "' ");
                //bllsmscode.
                if (codeModel != null && codeModel.Code == strCode && codeModel.OverDueTime > DateTime.Now)
                {
                    T_User user = bll.GetModel(strTel);
                    user.Password = newPasswod;
                    bll.ResetPassword(user);
                    codeModel.Active = 1;
                    bllsmscode.Update(codeModel);
                    return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", "密码修改成功")));
                }
                else
                {
                    return(Ok(ReturnJsonResult.GetJsonResult(-1, "Faild!", "Code Error")));
                }
            }
            catch (Exception ex) {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "Faild!", ex.Message)));
            }
        }
Example #14
0
        public IHttpActionResult DeleteStore()
        {
            int ID = int.Parse(requestHelper.GetRequsetForm("ID", ""));

            WebApi_BLL.T_Forum_Store bll = new WebApi_BLL.T_Forum_Store();
            bll.Delete(ID);
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #15
0
        public IHttpActionResult GetTuiJian()
        {
            WebApi_BLL.T_Forums          bll   = new WebApi_BLL.T_Forums();
            DataSet                      ds    = bll.GetList(5, "Status =2 and Flag = 2", "ForumID desc");
            List <WebApi_Model.T_Forums> model = bll.DataTableToList(ds.Tables[0]);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(model))));
        }
Example #16
0
        public IHttpActionResult GetStoreList(int UID)
        {
            //int UID = int.Parse(requestHelper.GetRequsetForm("UID", ""));
            WebApi_BLL.T_Forum_Store          bll  = new WebApi_BLL.T_Forum_Store();
            List <WebApi_Model.T_Forum_Store> list = bll.GetModelList("UID=" + UID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(list))));
        }
Example #17
0
        public IHttpActionResult GetOtherWish(int UID)
        {
            WebApi_BLL.T_Wish          bll   = new WebApi_BLL.T_Wish();
            DataSet                    ds    = bll.GetList(5, " Status = 1 and a.UID not in (" + UID + ")", " WishID desc");
            List <WebApi_Model.T_Wish> model = bll.DataTableToList(ds.Tables[0]);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(model))));
        }
Example #18
0
        public IHttpActionResult AddShopCar(dynamic model)
        {
            WebApi_BLL.T_User_ShopCar shopCar_bll = new WebApi_BLL.T_User_ShopCar();
            T_User_ShopCar            shopCar     = (T_User_ShopCar)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(T_User_ShopCar));

            shopCar_bll.Add(shopCar);
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #19
0
 public IHttpActionResult GetRechageTypeByID(int RechargeID)
 {
     WebApi_Model.T_RechargeType T_RechargeType = bll.GetModel(RechargeID);
     if (T_RechargeType == null)
     {
         return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", JsonConvert.SerializeObject(T_RechargeType))));
     }
     return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(T_RechargeType))));
 }
Example #20
0
        public IHttpActionResult DeletePhoto()
        {
            int ID = int.Parse(requestHelper.GetRequsetForm("ID", ""));

            WebApi_BLL.T_Forum_Photo bll = new WebApi_BLL.T_Forum_Photo();
            bool flag = bll.Delete(ID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", flag)));
        }
Example #21
0
        public IHttpActionResult LikeComment()
        {
            int CommentID = Convert.ToInt32(requestHelper.GetRequsetForm("CommentID", ""));

            WebApi_BLL.T_Forum_Comment   bll   = new WebApi_BLL.T_Forum_Comment();
            WebApi_Model.T_Forum_Comment model = bll.GetModel(CommentID);
            model.Likes += 1;
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(bll.Update(model)))));
        }
Example #22
0
        public IHttpActionResult CheckNickNameExisting(string Nickname, int UID)
        {
            bool flag = bll.CheckNickNameExisting(Nickname, UID);

            if (!flag)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "该昵称已被注册", false)));
            }
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #23
0
        public IHttpActionResult GetAddressByID(int AddressID)
        {
            //string strWhere = " UID = '" + UID + "'";
            //List<T_UserAddress> list = bll.GetModelList(strWhere);
            //int AddressID = int.Parse(requestHelper.GetRequsetForm("AddressID", ""));
            //bool falg = bll.Delete(AddressID);
            T_UserAddress Address = bll.GetModel(AddressID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(Address))));
        }
Example #24
0
        public IHttpActionResult CheckUserExisting(string Tel)
        {
            DataSet ds = bll.CheckUserExisting(Tel);

            if (ds.Tables[0].Rows.Count != 0)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "该用户已注册", false)));
            }
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #25
0
        public IHttpActionResult PostWish(dynamic model)
        {
            WebApi_Model.T_Wish wish = (WebApi_Model.T_Wish)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(WebApi_Model.T_Wish));
            WebApi_BLL.T_Wish   bll  = new WebApi_BLL.T_Wish();
            wish.PostDate = DateTime.Now;
            wish.Status   = 0;
            int key = bll.Add(wish);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(bll.GetModelList(" UID = " + wish.UID)))));
        }
Example #26
0
        public IHttpActionResult GetAllRechageType()
        {
            List <WebApi_Model.T_RechargeType> list = bll.DataTableToList(bll.GetAllList().Tables[0]);

            if (list == null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "Error", list)));
            }
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(list))));
        }
Example #27
0
        public IHttpActionResult AddForumLike()
        {
            WebApi_BLL.T_Forum_Likes bll = new WebApi_BLL.T_Forum_Likes();
            int UID     = int.Parse(requestHelper.GetRequsetForm("UID", ""));
            int ForumID = int.Parse(requestHelper.GetRequsetForm("ForumID", ""));

            WebApi_Model.T_Forum_Likes model = new WebApi_Model.T_Forum_Likes();
            bll.Add(model);
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #28
0
        public IHttpActionResult DeleteShopCar()
        {
            //int UID = int.Parse(requestHelper.GetRequsetForm("UID", ""));
            string ShopCarID = requestHelper.GetRequsetForm("ShopCarID", "");

            WebApi_BLL.T_User_ShopCar shopCar_bll = new WebApi_BLL.T_User_ShopCar();
            //shopCar_bll.Delete(ShopCarID);
            //List<T_User_ShopCar> shopCarList = shopCar_bll.GetModelList("UID = " + UID);
            DBHelper.ExecuteSql("delete FROM T_User_ShopCar where ShopCarID in (" + ShopCarID + ")");
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", true)));
        }
Example #29
0
        public IHttpActionResult SendMessage(dynamic model)
        {
            WebApi_BLL.T_System_Messages   tsmbll  = new WebApi_BLL.T_System_Messages();
            WebApi_Model.T_System_Messages message = (WebApi_Model.T_System_Messages)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(WebApi_Model.T_System_Messages));
            int id = tsmbll.Add(message);

            message.IsView    = 0;
            message.IsDelete  = 0;
            message.PostDate  = DateTime.Now;
            message.MessageID = id;
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(message))));
        }
Example #30
0
        public IActionResult Pull([FromBody] MessageRequestModel model)
        {
            ReturnJsonResult <Message> result = new ReturnJsonResult <Message>();

            LockControl.mutex.WaitOne();
            Message message = messageService.Pull(model.Topic);

            LockControl.mutex.ReleaseMutex();
            result.ReturnMsg = messageService.ReturnMsg;
            result.Status    = messageService.IsSuccess ? "ok" : "error";
            result.Result    = message;
            return(Json(result));
        }