Example #1
0
        public virtual storeActivity GetByPosition(int tradeAreaId, int floorNum, float mapX, float mapY, float scaling)
        {
            //存储过程名称
            string        sqlStr   = "dbo.dz_Area_GetStoreByPosition ";
            storeActivity storeAct = null;
            SqlDataReader dr       = SqlSeverProvider.ExecuteReader(sqlStr, CommandType.StoredProcedure);

            if (dr.Read())
            {
                storeAct = new storeActivity
                {
                    storeID    = dr.GetInt32(0),
                    storeCName = dr.GetString(1),
                    storeEName = dr.GetString(2)
                };
            }
            // 根据 storeId 获取活动信息  添加到 storeAct 后 在返回
            ActivityModels activity = _ActivityManager.GetByStoreId(storeAct.storeID);

            storeAct.activityID      = activity.activityID;
            storeAct.activityTitle   = activity.activityTitle;
            storeAct.activityContent = activity.activityContent;

            return(storeAct);
        }
Example #2
0
        public PartialViewResult ActivityStyle()
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.ActivityStyle = service.GetActivityStylelist();
            return(PartialView(model));
        }
Example #3
0
        public ActionResult Details(Guid id)
        {
            ServiceTemplate service = new ServiceTemplate();
            var             info    = service.GetbyActivity(id);
            var             model   = new ActivityModels().ToModel(info);

            ViewBag.ActivityByid = service.GetListActivityByid(id);
            ViewBag.Baomingmen   = service.GetRegistrationCount(id);
            return(View(model));
        }
Example #4
0
        public PartialViewResult NewActivity()
        {
            ServiceTemplate service = new ServiceTemplate();
            ActivityModels  model   = new ActivityModels();

            model.DataDictionary = service.GetActivityTypeList("活动类型");
            var id = model.DataDictionary.FirstOrDefault().Id;

            ViewBag.ActivityBytype = service.GetListActivityBytype(id);
            return(PartialView(model));
        }
Example #5
0
        ///查看更多 切换显示Ajax
        public JsonResult SeeAjaxIndex(string ActivityType, int pagings = 0)
        {
            ServiceTemplate service = new ServiceTemplate();
            ActivityModels  model   = new ActivityModels();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = new Guid(ActivityType);
            Paging paging = new Paging(model.Condition);
            var    ser    = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(ser);

            models.Paging = paging;
            models.Total  = paging.Total.ToString();
            models.Index  = paging.PageIndex.ToString();
            models.Size   = paging.PageSize.ToString();
            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public JsonResult FenyeSeeMoreNew(string type = "", int pagings = 0)
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = new Guid(type);
            Paging paging = new Paging(model.Condition);

            paging.PageIndex = pagings;
            var activity = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(activity);

            models.Paging = paging;
            models.Total  = paging.Total.ToString();
            models.Index  = paging.PageIndex.ToString();
            models.Size   = paging.PageSize.ToString();
            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public ActionResult SeeMore(int pagings = 0)
        {
            ActivityModels  model   = new ActivityModels();
            ServiceTemplate service = new ServiceTemplate();

            model.Condition.PageSize   = 3;
            model.Condition.ActityType = service.GetActivityTypeList("活动类型").Where(n => n.Name == "公益活动").FirstOrDefault().Id;
            Paging paging = new Paging(model.Condition);

            paging.PageIndex = pagings;
            var activity = service.SearchActivity(model.Condition, ref paging);
            ActivityModelsListModel models = new ActivityModelsListModel(activity);

            models.Paging         = paging;
            models.Total          = paging.Total.ToString();
            models.Index          = paging.PageIndex.ToString();
            models.Size           = paging.PageSize.ToString();
            models.DataDictionary = service.GetActivityTypeList("活动类型");
            return(View(models));
        }
Example #8
0
        public ActionResult CreateActivity(string callback, int?memberId, int?returnCollegeID)
        {
            ActivityModels activityModel = new ActivityModels {
                _Callback        = callback,
                _MemberId        = memberId ?? 0,
                _ReturnCollegeID = returnCollegeID ?? 0,
                _Campuses        = new SelectList(db.tb_Campus.OrderBy(s => s.CampusName), "CampusID", "CampusName"),
                _ActivityDate    = DateTime.UtcNow
            };

            activityModel._Colleges = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Value = "0", Text = "-- Select One --"
                }
            }.Concat(db.tb_College.Select(x => new SelectListItem
            {
                Value = x.CollegeID.ToString(), Text = x.CollegeName
            }));

            return(View(activityModel));
        }
Example #9
0
 public string InsertNewCode()
 {
     string insertResult = String.Empty;
     var content = JObject.Parse(Request.Params[0]);
     string codename = content.SelectToken("name").ToString();
     int codecount = Int32.Parse(content.SelectToken("count").ToString());
     List<string> codeList = YACHelper.GetCode(codecount);
     List<ActivityModels> activityCodeList = new List<ActivityModels>();
     foreach (string code in codeList)
     {
         ActivityModels codeModel = new ActivityModels();
         codeModel.ActivityType = codename;
         codeModel.CouponCode = code;
         activityCodeList.Add(codeModel);
     }
     DbServices.InsertActivityCodeList(activityCodeList);
     insertResult = JsonConvert.SerializeObject(new { msg = "success!" });
     return insertResult;
 }
Example #10
0
        public ActionResult CreateActivity([Bind(Include = "_ActivityName,_ActivityDate,_ActivityNote,_CollegeID,_CampusID,_Callback,_MemberId,_ReturnCollegeID")] ActivityModels model, FormCollection formCollection)
        {
            Error error = new Error();

            error.errCode = ErrorDetail.Success;
            error.errMsg  = ErrorDetail.GetMsg(error.errCode);
            List <string> errs = new List <string>();

            model._Colleges = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Value = "0", Text = "-- Select One --"
                }
            }.Concat(db.tb_College.Select(x => new SelectListItem
            {
                Value = x.CollegeID.ToString(), Text = x.CollegeName
            }));
            model._Campuses = new SelectList(db.tb_Campus.Where(s => s.CollegeID == model._CollegeID).OrderBy(s => s.CampusName), "CampusID", "CampusName");

            var userId = HttpContext.GetOwinContext().Authentication.User.Identity.GetUserId();

            using (LRCEntities context = new LRCEntities())
            {
                tb_Activity tb_Activity = new tb_Activity
                {
                    ActivityName  = model._ActivityName,
                    ActivityDate  = model._ActivityDate,
                    CampusID      = model._CampusID,
                    ActivityNote  = model._ActivityNote,
                    AddedBy       = userId,
                    AddedDateTime = DateTime.UtcNow
                };
                context.tb_Activity.Add(tb_Activity);
                try
                {
                    context.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    error.errCode = ErrorDetail.DataImportError;
                    error.errMsg  = ErrorDetail.GetMsg(error.errCode);
                    foreach (DbEntityValidationResult validationError in ex.EntityValidationErrors)
                    {
                        error.errMsg += ". Object: " + validationError.Entry.Entity.ToString();
                        foreach (DbValidationError err in validationError.ValidationErrors)
                        {
                            error.errMsg += ". " + err.ErrorMessage;
                        }
                    }
                    errs.Add("Error #" + error.errCode.ToString() + "!" + error.errMsg);
                    ViewData["ErrorList"] = errs;
                    return(View(model));
                }
            }
            switch (model._Callback)
            {
            case "AddActivityByMember":
                return(RedirectToAction("AddActivityByMember"));

            case "AddActivity":
                return(RedirectToAction("AddActivity", new { @id = model._MemberId }));

            case "AddPersonAssessmentActivity":
                return(RedirectToAction("AddPersonAssessmentActivity", "Assessment", new { @id = model._MemberId, CollegeID = model._ReturnCollegeID }));

            default:
                break;
            }
            return(View(model));
        }
Example #11
0
 public virtual void Update(int id, ActivityModels newActivity)
 {
 }
Example #12
0
 public virtual void Add(ActivityModels activity)
 {
 }
Example #13
0
 public static void InsertActivityCode(ActivityModels codeModel)
 {
     using (WeChatDbContext entity = new WeChatDbContext())
     {
         //var coupon = (from item in entity.ActivityModels select item).SingleOrDefault();
         entity.ActivityModels.Add(codeModel);
         entity.SaveChanges();
     }
 }
Example #14
0
 public static void UpdateCouponCustomerInfo(ActivityModels am)
 {
     using (WeChatDbContext entity = new WeChatDbContext())
     {
         var coupon = (from item in entity.ActivityModels where item.CouponCode == am.CouponCode select item).SingleOrDefault();
         if (coupon != null)
         {
             entity.Entry(coupon).State = System.Data.Entity.EntityState.Modified;
             coupon.ActivityName = am.ActivityName;
             coupon.CellPhone = am.CellPhone;
             coupon.CustomerName = am.CustomerName;
             coupon.Description = am.Description;
             coupon.IsCancel = am.IsCancel;
             coupon.IsRevisited = am.IsRevisited;
             coupon.IsUsed = am.IsUsed;
             entity.SaveChanges();
         }
     }
 }