public int BookOk(int bid)
        {
            try
            {
                HQ_BookRoom book = new HQ_BookRoom();
                book["id"] = bid;
                book.OStatus = 1;
                book.LastOperateTime = DateTime.Now;
                book.Save();
            }
            catch
            {
                return 0;
            }

            try
            {
                SearchModel sm = new SearchModel("uv_bookroom");
                sm["id"] = bid;
                sm.AddSearch("RoomName_G", "PhoneNum_G");
                var broom = sm.LoadEntity<HQ_BookRoom>();
                if (broom != null)
                {
                    NM.Util.SendUserInfo _U = new NM.Util.SendUserInfo() { isLog = 1, orgid = 555, username = broom.PhoneNum_G };
                    NM.Util.MsgSend.DirectSend(string.Format("尊敬的会员您好,您已成功预订 {0} 。", broom.RoomName_G), broom.PhoneNum_G, _U);
                }
            }
            catch { }

            return 1;
        }
Esempio n. 2
0
 public ActionResult Index(int id)
 {
     SearchModel sm = new SearchModel("HQ_DisplayContent");
     sm["ID"] = id;
     var entity = sm.LoadEntity<HQ_DisplayContent>();
     return View(entity);
 }
Esempio n. 3
0
 public JsonResult LoadRooms(int villageId)
 {
     SearchModel sm = new SearchModel("HQ_Room");
     sm["VillageID"] = villageId;
     var data = sm.Load<HQ_Room>().Data;
     return this.JsonNet(data);
 }
        public JsonResult LoadBenefits(int page)
        {
            var psize = 7;
            if (page > 1)
            {
                psize = psize + (page - 1) * 4;
            }
            SearchModel sm = new SearchModel("HQ_DisplayPanel");
            sm["DPanelType"] = (int)EnumDPanelType.MemberBenefit;
            sm.OrderBy("id");
            sm.PageIndex = 1;
            sm.PageSize = psize;
            var result = sm.Load<HQ_DisplayPanel>();

            List<HQ_DisplayPanel> list = null;
            if (page == 1)
            {
                list = result.Data;
            }
            else
            {
                list = new List<HQ_DisplayPanel>();
                for (var i = 7 + (page - 2) * 4; i < result.Data.Count; ++i)
                {
                    list.Add(result.Data[i]);
                }
            }

            return this.JsonNet(new { Data = list, PageCount = result.PageCount });
        }
 public JsonResult LoadBenefitDetails(int destinationId)
 {
     SearchModel sm = new SearchModel("HQ_DisplayContent");
     sm["DPanelID"] = destinationId;
     sm.AddSearch("ID", "Name");
     var result = sm.Load<HQ_DisplayContent>();
     return this.JsonNet(result.Data);
 }
 public JsonResult LoadCheaperDetails(int cheaperid)
 {
     SearchModel sm = new SearchModel("HQ_DisplayContent");
     sm["DPanelID"] = cheaperid;
     sm.AddSearch("ID", "Name");
     var result = sm.Load<HQ_DisplayContent>();
     return this.JsonNet(result.Data);
 }
Esempio n. 7
0
 public JsonResult GetLinks(SearchModel sm, int page_g, int psize_g)
 {
     sm.SearchID = "HQ_FLink";
     sm.OrderBy("ID", GOMFrameWork.DataEntity.EnumOrderBy.Desc);
     sm.PageIndex = page_g;
     sm.PageSize = psize_g;
     var result = sm.Load<HQ_FLink>();
     return ExController.JsonNet(result);
 }
Esempio n. 8
0
 public void CheckNewAnswer(int uid)
 {
     SearchModel sm = new SearchModel("uv_memberask");
     sm["MemberID"] = uid;
     sm.NewAnswerID = 0;
     sm.AnswerViewed = 0;
     sm.AddSearch("count(1)");
     var newcount = sm.LoadValue<int>();
     OutResult(new { ncount = newcount });
 }
        public JsonResult LoadDContentDesc(SearchModel se, int page_g, int psize_g)
        {
            se.SearchID = "hq_article";
            se["acategory"] = (int)EnumArticleCategory.RoomDesc;
            se.OrderBy("id");
            se.PageIndex = page_g;
            se.PageSize = psize_g;

            return ExController.JsonNet(se.Load<HQ_Article>());
        }
 public JsonResult LoadJsonData(int dPanelType)
 {
     SearchModel sm = new SearchModel("HQ_DisplayPanel");
     sm["DPanelType"] = dPanelType;
     var distinations = sm.Load<HQ_DisplayPanel>().Data;
     var select = HtmlSelect.GetHtmlSelectByCollection<HQ_DisplayPanel>(distinations, (e) =>
         {
             return new HtmlSelectItem() { k = e.Name, v = (int)e.ID };
         });
     return ExController.JsonNet(new { Detinations = select });
 }
Esempio n. 11
0
 public JsonResult LoadHotRoom(int destinationid, int dtype, int pindex = 1, int psize = 3)
 {
     SearchModel sm = new SearchModel("uv_VillageRoom_Hot");
     sm["DPanelID"] = destinationid;
     sm["DType"] = dtype;
     sm.PageIndex = pindex;
     sm.PageSize = psize;
     sm.OrderBy("bcount", GOMFrameWork.DataEntity.EnumOrderBy.Desc);
     var rooms = sm.Load<HQ_Room>();
     return this.JsonNet(rooms);
 }
        public JsonResult LoadData(SearchModel se)
        {
            #region 查询条件初始化 Example:se["Field"] = "value";

            se.SearchID = "hq_advertisement";
            se.OrderBy("id");

            #endregion

            var result = se.Load<HQ_Advertisement>();
            return ExController.JsonNet(result);
        }
Esempio n. 13
0
        public static int IsMoneyEnouth(int roomid, long userid, DateTime sdate, DateTime edate, out decimal balance, out int shopUserId, out string phoneNum, out decimal cost,out decimal price)
        {
            balance = 0;
            shopUserId = 0;
            phoneNum = string.Empty;
            cost = 0;
            price = 0;

            var days = edate.Subtract(sdate).Days;
            if (days <= 0)
            {
                return 0;
            }

            var userType = 1;
            var sm = new SearchModel("uv_MemberWithAmount");
            sm["id"] = userid;
            sm.AddSearch("PhoneNum", "ShopUserID_G", "Balance_G");
            var member = sm.LoadEntity<HQ_Member>();
            if (member != null)
            {
                balance = member.Balance_G;
                shopUserId = member.ShopUserID_G;
                phoneNum = member.PhoneNum;
                userType = member.UserType;
            }
            else
            {
                return 0;
            }

            sm = new SearchModel("hq_room");
            sm["id"] = roomid;
            sm.AddSearch("price", "vipprice");
            var room = sm.LoadEntity<HQ_Room>();
            if (room != null)
            {
                price = userType == 2 ? room.VipPrice : room.Price;
            }
            if (price == 0)
            {
                return 0;
            }

            cost = price * days;
            balance = balance - cost;
            if (balance < 0)
            {
                return -1;
            }
            return 1;
        }
 public JsonResult LoadJsonData()
 {
     SearchModel sm=new SearchModel("uv_DisplayContent");
     sm.AddSearch("ID","Name");
     sm["DPanelType"]=(int)EnumDPanelType.Distination;
     sm.OrderBy("DPanelID");
     var result= sm.Load<HQ_DisplayContent>();
     var items= HtmlSelect.GetHtmlSelectByCollection<HQ_DisplayContent>(result.Data,(e)=>
         {
             return new HtmlSelectItem(){ k=e.Name,v=(int)e.ID};
         });
     return ExController.JsonNet(new { Villages=items });
 }
Esempio n. 15
0
        public ActionResult RoomIndex(int id)
        {
            SearchModel sm = new SearchModel("HQ_DisplayContent");
            sm["ID"] = id;
            var entity = sm.LoadEntity<HQ_DisplayContent>();
            ViewBag.VillageID = id;

            sm = new SearchModel("hq_article");
            sm["refid"] = id;
            ViewBag.Descs = sm.Load<HQ_Article>().Data;

            return View(entity);
        }
Esempio n. 16
0
        public JsonResult LoadAgenterList(SearchModel se, int page_g, int psize_g)
        {
            #region 查询条件初始化 Example:se["Field"] = "value";

            se.SearchID="HQ_Agenter";
            se.OrderBy("id", EnumOrderBy.Desc);

            #endregion

            se.PageIndex = page_g;
            se.PageSize = psize_g;

            var result = se.Load<HQ_Agenter>();
            return ExController.JsonNet(result);
        }
Esempio n. 17
0
        public JsonResult LoadDestinations(SearchModel se, int page_g, int psize_g)
        {
            #region 查询条件初始化 Example:se["Field"] = "value";

            se.SearchID = "HQ_DisplayPanel";
            se["DPanelType"] = (int)EnumDPanelType.Distination;
            se.OrderBy("id", EnumOrderBy.Desc);

            #endregion

            se.PageIndex = page_g;
            se.PageSize = psize_g;

            var result = se.Load<HQ_DisplayPanel>();
            return ExController.JsonNet(result);
        }
Esempio n. 18
0
        public JsonResult LoadAsks(SearchModel se, int page_g, int psize_g)
        {
            #region 查询条件初始化 Example:se["Field"] = "value";

            se.SearchID = "uv_memberask";
            //.........................
            se.OrderBy("id", EnumOrderBy.Desc);

            #endregion

            se.PageIndex = page_g;
            se.PageSize = psize_g;

            var result = se.Load<HQ_MemberAsk>();
            return this.JsonNet(result);
        }
Esempio n. 19
0
        public ActionResult Index()
        {
            SearchModel sm = new SearchModel("HQ_Article");
            sm["ACategory"] = (int)EnumArticleCategory.SilderImg;
            var entity = sm.LoadEntity<HQ_Article>();
            if (entity != null)
            {
                ViewBag.SilderImgs = entity.AContent;
            }
            else
            {
                ViewBag.SilderImgs = string.Empty;
            }

            sm = new SearchModel("HQ_DisplayPanel");
            sm["DPanelType"] = (int)EnumDPanelType.Distination;
            sm.PageIndex = 1;
            sm.PageSize = 12;
            sm.OrderBy("id");
            ViewBag.DistList = sm.Load<HQ_DisplayPanel>().Data;

            return View();
        }
Esempio n. 20
0
 public string GetCopyright()
 {
     SearchModel sm = new SearchModel("hq_article");
     sm["ACategory"] = (int)EnumArticleCategory.Copyright;
     return sm.LoadEntity<HQ_Article>().AContent;
 }
        public JsonResult SaveMember(HQ_Member entity)
        {
            #region 用户名、手机号码是否重复

            SearchModel sm = SearchEntity.FormSql<SearchModel>("select count(id) from hq_member where username=@uname and isnull(isdelete,0)=0 and id<>@id",
                new SqlParameter("uname", entity.UserName), new SqlParameter("id", entity.ID));
            int count = sm.LoadValue<int>();
            if (count > 0)
            {
                return ExController.JsonNet(new { ID = -1 });
            }
            sm = SearchEntity.FormSql<SearchModel>("select count(id) from hq_member where phonenum=@pnum and isnull(isdelete,0)=0 and id<>@id",
                new SqlParameter("pnum", entity.PhoneNum), new SqlParameter("id", entity.ID));
            count = sm.LoadValue<int>();
            if (count > 0)
            {
                return ExController.JsonNet(new { ID = -2 });
            }

            #endregion

            try
            {
                using (var scope = new TransactionScope())
                {
                    if (entity.ID == 0)
                    {
                        var password = "******";

                        #region 维护新增数据

                        entity.UserPsw = MD5.EncryptString(password);
                        entity.ShopPsw = entity.UserPsw;
                        entity.CreateBy = LoginInfo.Current.UserName;
                        entity.CreateOn = DateTime.Now;
                        if (entity.UserType == 2)
                        {
                            entity.OpenVipDate = DateTime.Now.Date;
                        }

                        #endregion

                        entity.Save();

                        HttpClient _httpClient = new HttpClient();
                        _httpClient.BaseAddress = new Uri("http://mall.chinalvju.com/");
                        var dic = new Dictionary<string, string>();
                        dic.Add("UserName", entity.PhoneNum);
                        dic.Add("NickName", entity.UserName);
                        dic.Add("Password", password);
                        dic.Add("ConfirmPassword", password);

                        _httpClient.PostAsync("Account/Register", new FormUrlEncodedContent(dic));
                    }
                    else
                    {
                        #region 维护修改数据

                        entity.EditBy = LoginInfo.Current.UserName;
                        entity.EditOn = DateTime.Now;
                        if (entity.UserType == 2)
                        {
                            entity.OpenVipDate = DateTime.Now.Date;
                        }

                        #endregion

                        sm = new SearchModel("uv_MemberWithAmount");
                        sm["id"] = entity.ID;
                        var oldMem = sm.LoadEntity<HQ_Member>();
                        if (oldMem.PhoneNum != entity.PhoneNum)
                        {
                            Shop_Member s_mem = new Shop_Member();
                            s_mem["UserID"] = oldMem.ShopUserID_G;
                            s_mem["UserName"] = entity.PhoneNum;
                            s_mem.Save();
                        }

                        entity.Save();
                    }

                    scope.Complete();
                }

                return ExController.JsonNet(entity);
            }
            catch
            {
                return ExController.JsonNet(new { ID = 0 });
            }
        }
        public long ImportMember(string fpath)
        {
            fpath = Server.MapPath("~/" + fpath);
            if (!System.IO.File.Exists(fpath))
            {
                return 0;
            }

            var list = G.Util.Tool.ExcelHelper.Read<HQ_Member>(fpath, new string[] {
                "UserName","PhoneNum","MemberMedical"
                }, 1, (e) =>
                {
                    e.PhoneNum = e.PhoneNum;
                    e.UserPsw = e.PhoneNum.Substring(5);
                    e.UserType = (int)EnumUserType.Normal;
                    e.CreateBy = LoginInfo.Current.UserName;
                    e.CreateOn = DateTime.Now;
                });

            HttpClient _httpClient = new HttpClient();
            _httpClient.BaseAddress = new Uri("http://mall.chinalvju.com/");

            try
            {
                using (var scope = new TransactionScope())
                {
                    foreach (var l in list)
                    {
                        SearchModel se = new SearchModel("uv_MemberWithAmount");
                        se["UserName"] = l.UserName;
                        se.AddSearch("ID", "PhoneNum", "ShopUserID_G");
                        var member = se.LoadEntity<HQ_Member>();
                        if (member == null)
                        {
                            se = new SearchModel("HQ_Member");
                            se["PhoneNum"] = l.PhoneNum;
                            se.AddSearch("count(id)");
                            var memCount = se.LoadValue<int>();
                            if (memCount > 0)
                            {
                                continue;
                            }

                            var dic = new Dictionary<string, string>();
                            dic.Add("UserName", l.PhoneNum);
                            dic.Add("NickName", l.UserName);
                            dic.Add("Password", l.UserPsw);
                            dic.Add("ConfirmPassword", l.UserPsw);

                            _httpClient.PostAsync("Account/Register", new FormUrlEncodedContent(dic));

                            l.UserPsw = MD5.EncryptString(l.UserPsw);
                            l.ShopPsw = l.UserPsw;
                            l.Save();
                        }
                        else
                        {
                            if (!l.PhoneNum.Equals(member.PhoneNum))
                            {
                                //手机号码变化时,修改商城用户手机号码
                                Shop_Member s_mem = new Shop_Member();
                                s_mem["UserID"] = member.ShopUserID_G;
                                s_mem["UserName"] = l.PhoneNum;
                                s_mem.Save();
                            }

                            var mem = new HQ_Member();
                            mem["id"] = member.ID;
                            mem.PhoneNum = l.PhoneNum;
                            mem.MemberMedical = l.MemberMedical;
                            mem.Save();
                        }
                    }

                    scope.Complete();
                }
                return 1;
            }
            catch
            {
                return 0;
            }
        }
Esempio n. 23
0
        public int SendMsgCode(string phone, string type)
        {
            if (type == null || type.Length == 0)
            {
                return -2;//系统错误
            }

            if (phone != null && phone.Length > 0 && Regex.Match(phone, @"^[1][3,5,8][0-9]{9}$", RegexOptions.Compiled).Success)
            {
                var msgKey = string.Empty;
                if ("1".Equals(type))
                {
                    SearchModel se = new SearchModel("hq_member");
                    se["PhoneNum"] = phone;
                    se.AddSearch("count(1)");
                    var count = se.LoadValue<int>();
                    if (count > 0)
                    {
                        return 9;
                    }

                    msgKey = "用户注册短信验证码:";
                }

                if ("3".Equals(type))
                {
                    SearchModel se = new SearchModel("hq_member");
                    se["PhoneNum"] = phone;
                    se.AddSearch("count(1)");
                    var count = se.LoadValue<int>();
                    if (count > 0)
                    {
                        return 9;
                    }

                    msgKey = "用户修改手机号码短信验证码:";
                }

                if ("2".Equals(type))
                {
                    msgKey = "用户找回密码验证码:";
                }

                var yzm = string.Empty;
                foreach (var i in Ran.GetRandomArray(6, 0, 9))
                {
                    yzm += i.ToString();
                }
                SendUserInfo _U = new SendUserInfo() { isLog = 1, orgid = 555, username = phone };
                if (MsgSend.DirectSend(msgKey + yzm, phone, _U))
                {
                    base.HttpContext.Cache["msg-" + phone] = yzm;
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return -1;
            }
        }
Esempio n. 24
0
 public JsonResult GetSilderImg()
 {
     SearchModel sm = new SearchModel("HQ_Article");
     sm["ACategory"] = (int)EnumArticleCategory.SilderImg;
     var entity = sm.LoadEntity<HQ_Article>();
     if (entity != null)
     {
         return this.JsonNet(entity);
     }
     return null;
 }
Esempio n. 25
0
 public ActionResult ViewGuidInfo(int id)
 {
     SearchModel sm = new SearchModel("HQ_Article");
     sm["ID"] = id;
     var article = sm.LoadEntity<HQ_Article>();
     return View(article);
 }
Esempio n. 26
0
        public static int IsMoneyEnouth(int orderid,out decimal balance, out int shopUserId, out string phoneNum, out decimal cost)
        {
            balance = 0;
            shopUserId = 0;
            phoneNum = string.Empty;
            cost = 0;

            var price = 0;
            var userid = 0;

            var sm = new SearchModel("hq_bookroom");
            sm["ID"] = orderid;
            var order = sm.LoadEntity<HQ_BookRoom>();
            if (order == null)
            {
                return 0;
            }
            price = order.Price;
            userid = order.MemberID;
            var sdate = order.BookStartTime;
            var edate = order.BookEndTime;

            var days = edate.Subtract(sdate).Days;
            if (days <= 0)
            {
                return 0;
            }

            sm = new SearchModel("uv_MemberWithAmount");
            sm["id"] = userid;
            sm.AddSearch("PhoneNum", "ShopUserID_G", "Balance_G");
            var member = sm.LoadEntity<HQ_Member>();
            if (member != null)
            {
                balance = member.Balance_G;
                shopUserId = member.ShopUserID_G;
                phoneNum = member.PhoneNum;
            }
            else
            {
                return 0;
            }

            cost = price * days;
            balance = balance - cost;
            if (balance < 0)
            {
                return -1;
            }
            return 1;
        }
Esempio n. 27
0
 public JsonResult GetArticle(int atype)
 {
     SearchModel sm = new SearchModel("HQ_Article");
     sm["ACategory"] = atype;
     var entity = sm.LoadEntity<HQ_Article>();
     if (entity != null)
     {
         return this.JsonNet(entity);
     }
     return null;
 }
Esempio n. 28
0
 public ActionResult ArticleIndex(int atype)
 {
     SearchModel sm = new SearchModel("HQ_Article");
     sm["ACategory"] = atype;
     var entity = sm.LoadEntity<HQ_Article>();
     if (entity == null)
     {
         return View(new HQ_Article() { AContent = "维护中。。。" });
     }
     return View(entity);
 }
Esempio n. 29
0
 public JsonResult GetAdvPBottom()
 {
     SearchModel sm = new SearchModel("HQ_Advertisement");
     sm["ID"] = 1;
     HQ_Advertisement adv = sm.LoadEntity<HQ_Advertisement>();
     return this.JsonNet(adv);
 }
Esempio n. 30
0
 public JsonResult GetFLink(int ltype)
 {
     SearchModel sm = new SearchModel("hq_flink");
     sm["LinkType"] = ltype;
     var links = sm.Load<HQ_FLink>().Data;
     return ExController.JsonNet(links);
 }