Ejemplo n.º 1
0
 public bool Add(Activity atvy)
 {
     dalBase.sql = "INSERT INTO db_activity VALUES (null,@content,@publishTime,@isactive,"
         + "@preStart,@overEnd,@isVisitApply,@contentDetails);";
     dalBase.List_param = new List<MySqlParameter>()
     {
         new MySqlParameter("@content",atvy.Content),
         new MySqlParameter("@publishTime",atvy.PublishTime),
         new MySqlParameter("@isactive",atvy.IsActive),
         new MySqlParameter("@isVisitApply",atvy.IsVisitApply),
         new MySqlParameter("@preStart",atvy.PreStart),
         new MySqlParameter("@overEnd",atvy.OverEnd),
         new MySqlParameter("@contentDetails",atvy.ContentDetails)
     };
     return dalBase.Run(Behavious.INSERT_OR_UPDATE_OR_DELETE, true);
 }
Ejemplo n.º 2
0
        private bool CreateInstance(HttpRequestBase req, ref Activity atvy)
        {
            bool flag = true;
            try
            {
                atvy =  new Activity()
                {
                    ID = Convert.ToInt32(req.Form["id"]),
                    Content = req.Form["content"].ToString(),
                    IsActive = Convert.ToByte(req.Form["isactive"]),
                    PreStart = Convert.ToDateTime(req.Form["prestart"]),
                    OverEnd = Convert.ToDateTime(req.Form["overend"]),
                    ContentDetails = req.Form["contentdetails"].ToString(),
                    IsVisitApply =(byte) (req.Form["isvisitapply"]=="on"?1:0),
                    PublishTime = Convert.ToDateTime(req.Form["publish"]),

                    //PreEnd = Convert.ToDateTime(req.Form["preend"]),
                    //MidStart = Convert.ToDateTime(req.Form["midstart"]),
                    //MidEnd = Convert.ToDateTime(req.Form["midend"]),
                    //OverStart = Convert.ToDateTime(req.Form["overstart"]),
                };
            }
            catch (System.Exception ex)
            {
                flag = false;
                atvy = null;
            }
            return flag;
        }
Ejemplo n.º 3
0
 public ResponseStatus GetActivity(int id,Activity atvy)
 {
     activityDal = new ActivityDAL();
     ResponseStatus resp = activityDal.GetActivity(id, atvy);
     activityDal.ReturnUnitToPool();
     return resp;
 }
Ejemplo n.º 4
0
 public ActionResult Update(int? id)
 {
     if (Request.Form != null && Request.Form.Count > 0)
     {
         ResponseStatus resp = activityService.UpdateActivity(Request);
         return this.JudgeResult(resp, () => RedirectToAction("Details",
             new { msg = string.Format("更新了活动:{0}", Request.Form["content"]) }));
     }
     else
     {
         Activity atvy = new Activity();
         ResponseStatus resp = activityService.GetActivity((Int32)id, atvy);
         return this.JudgeResult(resp, () => View(atvy));
     }
 }
Ejemplo n.º 5
0
 public ResponseStatus GetActivity(int id, Activity atvy)
 {
     dalBase.sql = "SELECT * FROM db_activity WHERE id=@id";
     dalBase.Param = new MySqlParameter("@id",id);
     bool isSuccess = dalBase.Run(Behavious.SELECT_WITH_SINGLEPARAM, false);
     return this.JudgeDBResult(isSuccess,
         () =>
         {
             dalBase.DataRead.Read();
             atvy.ID = Convert.ToInt32(dalBase.DataRead["id"]);
             atvy.Content = dalBase.DataRead["Content"].ToString();
             atvy.IsActive = Convert.ToByte(dalBase.DataRead["isactive"]);
             atvy.IsVisitApply = Convert.ToByte(dalBase.DataRead["isVisitApply"]);
             atvy.PublishTime = dalBase.DataRead["publishTime"] != DBNull.Value ? Convert.ToDateTime(dalBase.DataRead["publishTime"]) : GLB.initTime;
             atvy.PreStart = dalBase.DataRead["preStart"] != DBNull.Value ? Convert.ToDateTime(dalBase.DataRead["preStart"]) : GLB.initTime;
             atvy.OverEnd = dalBase.DataRead["overEnd"] != DBNull.Value ? Convert.ToDateTime(dalBase.DataRead["overEnd"]) : GLB.initTime;
             atvy.ContentDetails = dalBase.DataRead["contentDetails"].ToString();
         },null);
 }
Ejemplo n.º 6
0
 public bool Update(Activity atvy)
 {
     dalBase.sql = "UPDATE db_activity SET content=@content,publishTime=@publishTime,isactive= @isactive,isVisitApply=@isVisitApply,preStart=@preStart," +
         "overEnd=@overEnd,contentDetails=@contentDetails WHERE id =@id";
     dalBase.List_param = new List<MySqlParameter>()
     {
         new MySqlParameter("@content",atvy.Content),
         new MySqlParameter("@publishTime",atvy.PublishTime),
         new MySqlParameter("@isactive",atvy.IsActive),
         new MySqlParameter("@isVisitApply",atvy.IsVisitApply),
         new MySqlParameter("@preStart",atvy.PreStart),
         new MySqlParameter("@overEnd",atvy.OverEnd),
         new MySqlParameter("@contentDetails",atvy.ContentDetails),
         new MySqlParameter("@id",atvy.ID)
     };
     return dalBase.Run(Behavious.INSERT_OR_UPDATE_OR_DELETE, true);
 }