Beispiel #1
0
        //快速消费
        public void Fastmoney()
        {
            try
            {
                ConsumeOrders co    = new ConsumeOrders();
                DataTable     Cdt   = Session["CriD"] as DataTable;
                Users         Udt   = Session["UserInfo"] as Users;
                DateTime      de    = DateTime.Now;
                string        Strde = de.ToString("yyyyMMddHHmmss");
                co.S_ID             = Udt.S_ID;
                co.U_ID             = Udt.U_ID;
                co.CO_OrderCode     = Strde;
                co.CO_OrderType     = 5;
                co.MC_ID            = int.Parse(Cdt.Rows[0]["MC_ID"].ToString());
                co.MC_CardID        = Cdt.Rows[0]["MC_CardID"].ToString();
                co.CO_TotalMoney    = decimal.Parse(Request.Form["nMoney"]);
                co.CO_DiscountMoney = decimal.Parse(Request.Form["factMoney"]);
                co.CO_GavePoint     = int.Parse(Request.Form["autoPoint"]);
                co.CO_CreateTime    = de;
                co.CO_Remark        = Request.Form["Remark"];
                db.ConsumeOrders.InsertOnSubmit(co);
                MemCards m = (from i in db.MemCards where i.MC_CardID == Cdt.Rows[0]["MC_CardID"].ToString() select i).First();

                m.MC_Point      = int.Parse(Cdt.Rows[0]["MC_Point"].ToString()) + int.Parse(Request.Form["autoPoint"]);
                m.MC_TotalMoney = (float.Parse(Cdt.Rows[0]["MC_TotalMoney"].ToString())) + (float.Parse(Request.Form["factMoney"]));
                m.MC_TotalCount = (int.Parse(Cdt.Rows[0]["MC_TotalCount"].ToString())) + 1;
                db.SubmitChanges();
                Response.Write("ok");
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
        }
Beispiel #2
0
        //添加消费订单  快速消费
        public ActionResult InsertConsume(ConsumeOrders c)
        {
            MPMS.Models.Users user = Session["UserInfo"] as MPMS.Models.Users;
            var U_ID             = user.U_ID;
            var S_ID             = user.S_ID;
            var CO_TotalMoney    = Request.Form["CO_TotalMoney"];
            var CO_DiscountMoney = Request.Form["CO_DiscountMoney"];
            var CO_CreateTime    = Request.Form["CO_CreateTime"];
            var CO_OrderType     = 5;
            var MC_ID            = Request.Form["MC_ID"];
            var MC_CardID        = Request.Form["MC_CardID"];

            c.CO_TotalMoney    = decimal.Parse(CO_TotalMoney);
            c.CO_DiscountMoney = decimal.Parse(CO_DiscountMoney);
            c.CO_CreateTime    = DateTime.Parse(CO_CreateTime);
            c.CO_OrderType     = byte.Parse(CO_OrderType.ToString());
            c.MC_ID            = int.Parse(MC_ID);
            c.MC_CardID        = MC_CardID;
            c.U_ID             = int.Parse(U_ID.ToString());
            c.S_ID             = int.Parse(S_ID.ToString());

            db.ConsumeOrders.InsertOnSubmit(c);
            db.SubmitChanges();
            return(Content("OK"));
        }
Beispiel #3
0
 public ActionResult CreateManage(Users u)
 {
     try
     {
         // TODO: Add insert logic here
         //判断登入名是否已经存在
         var num = (from i in db.Users
                    where i.U_LoginName == Request.Form["U_LoginName"]
                    select i).Count();
         if (num < 1)
         {
             //保存修改
             u.S_ID        = Convert.ToInt32(Request.Form["S_ID"]);
             u.U_LoginName = Request.Form["U_LoginName"];
             u.U_Password  = "******";
             u.U_Role      = 1;
             u.U_CanDelete = true;
             db.Users.InsertOnSubmit(u);
             db.SubmitChanges();
             return(Content("OK"));
         }
         return(Content("NO"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #4
0
 public ActionResult Create(CardLevels c)
 {
     try
     {
         // 获取
         string CL_LevelName = Request.Form["CL_LevelName"];
         string CL_NeedPoint = Request.Form["CL_NeedPoint"];
         float  CL_Point     = float.Parse(Request.Form["CL_Point"]);
         float  CL_Percent   = float.Parse(Request.Form["CL_Percent"]);
         //根据用户输入的ID查询数据库数据
         var num = (from i in db.CardLevels
                    where i.CL_LevelName == CL_LevelName
                    select i).Count();
         //验证会员等级名称是否已经存在
         if (num < 1)
         {
             c.CL_LevelName = CL_LevelName;
             c.CL_NeedPoint = CL_NeedPoint;
             c.CL_Point     = CL_Point;
             c.CL_Percent   = CL_Percent;
             //提交
             db.CardLevels.InsertOnSubmit(c);
             db.SubmitChanges();
             return(Content("OK"));
         }
         return(Content("NO"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #5
0
 public ActionResult Create(ExchangGifts g)
 {
     try
     {
         string EG_GiftCode = Request.Form["EG_GiftCode"];
         string EG_GiftName = Request.Form["EG_GiftName"];
         int    EG_Point    = int.Parse(Request.Form["EG_Point"]);
         int    EG_Number   = int.Parse(Request.Form["EG_Number"]);
         string EG_Remark   = Request.Form["EG_Remark"];
         var    result      = (from i in db.ExchangGifts
                               where i.EG_GiftCode == EG_GiftCode
                               select i).Count();
         if (result < 1)
         {
             g.EG_GiftCode   = EG_GiftCode;
             g.EG_GiftName   = EG_GiftName;
             g.EG_Point      = EG_Point;
             g.EG_Number     = EG_Number;
             g.EG_Remark     = EG_Remark;
             g.S_ID          = 1;
             g.EG_Photo      = "";
             g.EG_ExchangNum = 0;
             db.ExchangGifts.InsertOnSubmit(g);
             db.SubmitChanges();
             return(Content("OK"));
         }
         return(Content("NO"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #6
0
        public ActionResult CreateShopInfo(Shops s)
        {
            try
            {
                //获取数据
                s.S_Name        = Request.Form["S_Name"];
                s.S_Category    = int.Parse(Request.Form["S_Category"]);
                s.S_ContactName = Request.Form["S_ContactName"];
                s.S_ContactTel  = Request.Form["S_ContactTel"];
                s.S_Address     = Request.Form["S_Address"];
                s.S_Remark      = Request.Form["S_Remark"];

                s.S_CreateTime    = DateTime.Now; //加盟时间
                s.S_IsHasSetAdmin = false;        //默认无管理员

                //添加数据
                db.Shops.InsertOnSubmit(s);
                //保存修改
                db.SubmitChanges();

                return(Content("OK"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #7
0
        //添加
        public ActionResult CreateEX()
        {
            ExchangGifts es = new ExchangGifts();

            es.S_ID          = (Session["UserInfo"] as Users).S_ID;
            es.EG_ExchangNum = 0;
            es.EG_GiftCode   = Request.Form["eG_GiftCode"];
            es.EG_GiftName   = Request.Form["eG_GiftName"];
            es.EG_Photo      = Request.Form["eG_Photo"];
            es.EG_Point      = int.Parse(Request.Form["eG_Point"]);
            es.EG_Number     = int.Parse(Request.Form["eG_Number"]);
            es.EG_Remark     = Request.Form["eG_Remark"];
            db.ExchangGifts.InsertOnSubmit(es);
            db.SubmitChanges();
            return(Content("ok"));
        }
Beispiel #8
0
        //添加礼品记录
        public ActionResult Index(string ExchangLogs)
        {
            ViewBag.err = -1;
            try
            {
                Users u  = Session["UserInfo"] as Users;
                int   id = u.S_ID.Value;
                JavaScriptSerializer jss  = new JavaScriptSerializer();
                List <ExchangLogs>   list = jss.Deserialize <List <ExchangLogs> >(ExchangLogs);
                for (int i = 0; i < list.Count; i++)
                {
                    ExchangLogs el = new Models.ExchangLogs();
                    el.S_ID          = id;
                    el.U_ID          = u.U_ID;
                    el.MC_CardID     = list[i].MC_CardID;
                    el.MC_ID         = list[i].MC_ID;
                    el.MC_Name       = list[i].MC_Name;
                    el.EG_GiftName   = list[i].EG_GiftName;
                    el.EL_CreateTime = DateTime.Now;
                    el.EL_Point      = list[i].EL_Point;
                    el.EG_ID         = list[i].EG_ID;
                    el.EG_GiftCode   = list[i].EG_GiftCode;
                    el.EL_Number     = list[i].EL_Number;
                    ExchangGifts ruslt = (from n in db.ExchangGifts
                                          where n.EG_ID == list[i].EG_ID
                                          select n).First();
                    MemCards m = (from n in db.MemCards
                                  where n.MC_CardID == list[i].MC_CardID
                                  select n).First();
                    m.MC_Point          = m.MC_Point - list[i].EL_Point;
                    ruslt.EG_ExchangNum = (ruslt.EG_ExchangNum + list[i].EL_Number.Value);
                    db.ExchangLogs.InsertOnSubmit(el);
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                ViewBag.err = "错误消息" + ex.Message;
            }
            return(View());
        }
Beispiel #9
0
        //添加数据
        public ActionResult Creates()
        {
            try
            {
                //获取数据
                int    sID        = Convert.ToInt32((Session["UserInfo"] as Users).S_ID);
                string uLoginName = Request.Form["ULoginName"];
                string uPassword  = Request.Form["UPassword"];
                string uRealName  = Request.Form["URealName"];
                string uSex       = Request.Form["USex"];
                string uTelephone = Request.Form["UTelephone"];
                int    uRole      = int.Parse(Request.Form["URole"]);
                bool   uCanDelete = bool.Parse(Request.Form["UCanDelete"]);

                var result = (from i in db.Users
                              where i.U_LoginName == uLoginName
                              select i);
                if (result.Count() < 1)
                {
                    Users u = new Users();
                    //将修改的数据赋值给实体
                    u.U_CanDelete = uCanDelete;
                    u.S_ID        = sID;
                    u.U_LoginName = uLoginName;
                    u.U_Password  = uPassword;
                    u.U_RealName  = uRealName;
                    u.U_Sex       = uSex;
                    u.U_Telephone = uTelephone;
                    u.U_Role      = uRole;
                    //添加数据,并保存修改
                    db.Users.InsertOnSubmit(u);
                    db.SubmitChanges();
                    return(Content("OK"));
                }
                return(Content("ON"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
 public void ReportTheLossOfSthORLock()
 {
     try
     {
         (from i in db.MemCards where i.MC_CardID == Request.Form["MC_CardID"] select i).First().MC_State = int.Parse(Request.Form["MC_State"]);
         db.SubmitChanges();
         Response.Write("修改成功!");
     }
     catch (Exception ex)
     {
         Response.Write("修改失败!错误消息:" + ex.Message);
     }
 }