예제 #1
0
        /// <summary>
        /// 获取商品信息
        /// </summary>
        /// <returns></returns>
        public ShopResult GetShopList()
        {
            ShopResult result = new ShopResult();

            using (var db = SugarDao.GetInstance(LoginUser.GetConstr()))
            {
                try
                {
                    var list = db.Queryable <base_shop>().Where(a => a.del_flag).OrderBy("shop_id DESC").ToList();
                    if (list.Count <= 0)
                    {
                        result.success = false;
                        result.Msg     = "暂无店铺信息!";
                        return(result);
                    }
                    var list1 = "<option value=\"0\">请选择...</option>";
                    foreach (var item in list)
                    {
                        list1 += "<option value=\"" + item.shop_id + "\">" + item.shop_name + "</option>";
                    }

                    result.success = true;
                    result.Msg     = list1;
                    return(result);
                }
                catch (Exception ex)
                {
                    result.success = false;
                    result.Msg     = "获取店铺信息失败!";
                    return(result);
                }
            }
        }
예제 #2
0
        public ActionResult GetShopList()
        {
            ShopResult com = new ShopResult();

            try
            {
                com = _service.GetShopList();
                return(Json(com));
            }
            catch (Exception ex)
            {
                com.Msg     = ex.ToString();
                com.success = false;
                return(Json(com));
            }
        }
예제 #3
0
        public ActionResult Save(base_shop model)
        {
            ShopResult com = new ShopResult();

            try
            {
                com = _service.Save(model);
                return(Json(com));
            }
            catch (Exception ex)
            {
                com.Msg     = ex.ToString();
                com.success = false;
                return(Json(com));
            }
        }
예제 #4
0
        /// <summary>
        /// 获取币种下拉框信息
        /// </summary>
        /// <returns></returns>
        public ShopResult GetCountryList()
        {
            ShopResult result = new ShopResult();

            using (var db = SugarDao.GetInstance(LoginUser.GetConstr()))
            {
                try
                {
                    //var list = db.Queryable<base_platform>().Where(a => a.del_flag).OrderBy("platform_id DESC").ToList();
                    //if (list.Count <= 0)
                    //{
                    //    result.success = false;
                    //    result.Msg = "暂无平台信息!";
                    //    return result;
                    //}
                    var list1 = "<option value=\"0\">请选择...</option>" +
                                "<option value=\"1\">日元</option>" +
                                "<option value=\"2\">美元</option>" +
                                "<option value=\"3\">欧元</option>" +
                                "<option value=\"4\">英镑</option>" +
                                "<option value=\"5\">人民币</option>" +
                                "<option value=\"6\">新加坡元</option>";
                    // foreach (var item in list)
                    //{
                    //  list1 += "<option value=\"" + item.platform_id + "\">" + item.platform_name + "</option>";
                    // }

                    result.success = true;
                    result.Msg     = list1;
                    return(result);
                }
                catch (Exception ex)
                {
                    result.success = false;
                    result.Msg     = "获取平台信息失败!";
                    return(result);
                }
            }
        }
예제 #5
0
        public ActionResult Getpage(string pagenum, string onepagecount)
        {
            ShopResult com = new ShopResult();

            if (!Regex.IsMatch(pagenum, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(pagenum))
            {
                com.Msg     = "页数不正确";
                com.success = false;
                return(Json(com));
            }

            if (!Regex.IsMatch(onepagecount, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(onepagecount))
            {
                com.Msg     = "每页数量不正确";
                com.success = false;
                return(Json(com));
            }
            int    totil     = 0;
            int    totilpage = 0;
            string exmsg     = string.Empty;
            List <ShopResultModel> mylist = _service.GetShopList(Convert.ToInt32(pagenum), Convert.ToInt32(onepagecount), out totil, out totilpage, out exmsg);

            if (!string.IsNullOrEmpty(exmsg))
            {
                com.Msg     = exmsg;
                com.success = false;
                return(Json(com));
            }
            else
            {
                ShopViewModel mylistview = new ShopViewModel();
                mylistview.supplist   = mylist;
                mylistview.totil      = totil.ToString();
                mylistview.totilcount = totilpage.ToString();
                com.DataResult        = mylistview;
                com.success           = true;
                return(Json(com));
            }
        }
예제 #6
0
        /// <summary>
        /// 修改 添加的方法
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ShopResult Save(base_shop model)
        {
            bool       rstNum = false;
            ShopResult result = new ShopResult();

            using (var db = SugarDao.GetInstance(LoginUser.GetConstr()))
            {
                #region 判断
                if (model == null)
                {
                    result.success = false;
                    result.Msg     = "请填写信息!";
                    return(result);
                }

                if (model.platform_id == 0)
                {
                    result.success = false;
                    result.Msg     = "请选择平台!";
                    return(result);
                }

                if (string.IsNullOrWhiteSpace(model.shop_name))
                {
                    result.success = false;
                    result.Msg     = "请填写店铺名称!";
                    return(result);
                }

                if (string.IsNullOrWhiteSpace(model.shop_account))
                {
                    result.success = false;
                    result.Msg     = "请填写管理账号!";
                    return(result);
                }

                if (model.country_id == 0)
                {
                    result.success = false;
                    result.Msg     = "请选择店铺币种!";
                    return(result);
                }


                if (string.IsNullOrWhiteSpace(model.shop_telephone))
                {
                    result.success = false;
                    result.Msg     = "请填写店铺电话!";
                    return(result);
                }


                if (string.IsNullOrWhiteSpace(model.shop_zipcode))
                {
                    result.success = false;
                    result.Msg     = "请填写店铺邮编!";
                    return(result);
                }


                if (string.IsNullOrWhiteSpace(model.shop_address))
                {
                    result.success = false;
                    result.Msg     = "请填写店铺地址!";
                    return(result);
                }

                if (model.platform_lrish == null)
                {
                    result.success = false;
                    result.Msg     = "请填写平台扣点!";
                    return(result);
                }
                #endregion

                if (model.shop_id > 0)
                {
                    var list = db.Queryable <base_shop>().InSingle(model.shop_id);
                    if (list == null)
                    {
                        result.success = false;
                        result.Msg     = "不存在的店铺信息";
                        return(result);
                    }
                    if (list.shop_status.Value)
                    {
                        list.shop_status = false;
                    }
                    else
                    {
                        list.shop_status = true;
                    }
                    list.edit_time    = DateTime.Now;
                    list.edit_user_id = LoginUser.Current.user_id;
                    rstNum            = db.Update <base_shop>(list);
                }
                else//添加店铺
                {
                    var base_shop = db.Queryable <base_shop>().Where(c => c.del_flag && c.shop_name == model.shop_name).ToList();
                    if (base_shop.Count > 0)
                    {
                        result.success = false;
                        result.Msg     = "已存在的店铺信息,操作失败!";
                        return(result);
                    }
                    model.create_time     = DateTime.Now;
                    model.create_user_id  = LoginUser.Current.user_id;
                    model.del_flag        = true;
                    model.del_user_id     = 0;
                    model.del_time        = DateTime.Now;
                    model.edit_time       = DateTime.Now;
                    model.edit_user_id    = 0;
                    model.remark          = model.shop_name;
                    model.settlm_currency = 0;
                    model.shop_status     = true;
                    model.LStablename     = db.Queryable <base_platform>().Where(s => s.platform_id == model.platform_id).FirstOrDefault().platform_name;
                    var id = db.Insert <base_shop>(model);
                    if (id.ObjToInt() > 0)
                    {
                        rstNum = true;
                    }
                }

                if (rstNum)
                {
                    result.success = true;
                    result.URL     = "/Shop/Index";
                    result.Msg     = "操作成功";
                    return(result);
                }
                else
                {
                    result.success = false;
                    result.Msg     = "操作失败";
                    return(result);
                }
            }
        }
예제 #7
0
 private static void SendShopResult(GameClient client, ShopResult result)
 {
     using var pw = new PacketWriter(ServerOperationCode.NpcShopResult);
     pw.WriteByte(result);
     client.Send(pw);
 }