예제 #1
0
        private string editPickupTimes(HttpContext context)
        {
            int id = 0;
            int pickup_address_id = int.Parse(context.Request.Params["pickup_address_id"]);
            int eat_type          = int.Parse(context.Request.Params["eat_type"]);
            int pickup_time       = int.Parse(context.Request.Params["pickup_time"]);

            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");
            strWhere.AppendFormat(" and pickup_address_id = {0}", pickup_address_id);
            strWhere.AppendFormat(" and eat_type = {0}", eat_type);
            strWhere.AppendFormat(" and pickup_time = {0}", pickup_time);

            WK.BLL.bus_pickup_times bll = new WK.BLL.bus_pickup_times();
            DataSet ds = new DataSet();

            ds = bll.GetListByPageInfo(strWhere.ToString(), "", 0, 100);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
            }

            WK.Model.bus_pickup_times model = new Model.bus_pickup_times();
            model.id = id;
            //model.create_by ;
            //model.create_date
            model.eat_type          = eat_type;
            model.is_delete         = 0;
            model.pickup_address_id = pickup_address_id;

            string   spickup_end_time = String.Format("{0:HH:mm:ss}", DateTime.Parse(context.Request.Params["pickup_end_time"]));
            TimeSpan pickup_end_time  = TimeSpan.Parse(spickup_end_time);

            model.pickup_end_time = pickup_end_time;

            string   spickup_start_time = String.Format("{0:HH:mm:ss}", DateTime.Parse(context.Request.Params["pickup_start_time"]));
            TimeSpan pickup_start_time  = TimeSpan.Parse(spickup_start_time);

            model.pickup_start_time = pickup_start_time;
            model.pickup_time       = pickup_time;
            model.remark            = context.Request.Params["remark"];
            //model.update_by
            //model.update_date

            ReturnInfo returnInfo = new ReturnInfo();

            returnInfo.isSuccess = model.id > 0?bll.Update(model):bll.Add(model);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
예제 #2
0
        private string deletePickupTimes(HttpContext context)
        {
            ReturnInfo returnInfo = new ReturnInfo();

            returnInfo.isSuccess = false;
            WK.BLL.bus_pickup_times bll = new WK.BLL.bus_pickup_times();
            int id = int.Parse(context.Request.Params["id"]);

            if (id > 0)
            {
                WK.Model.bus_pickup_times model = bll.GetModel(id);
                model.is_delete      = 1;
                returnInfo.isSuccess = bll.Update(model);
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(returnInfo));
        }
예제 #3
0
        private string getPickupTimes(HttpContext context)
        {
            int pickup_address_id = int.Parse(context.Request.Params["pickup_address_id"]);

            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" is_delete != 1");
            strWhere.AppendFormat(" and pickup_address_id = {0} ", pickup_address_id);

            int pageIndex  = int.Parse(context.Request.Params["pageIndex"]);
            int pageSize   = int.Parse(context.Request.Params["pageSize"]);
            int startIndex = pageIndex >= 0 ? pageSize * pageIndex : 0;

            WK.BLL.bus_pickup_times bll = new WK.BLL.bus_pickup_times();
            DataSet ds = new DataSet();

            ds = bll.GetListByPageInfo(strWhere.ToString(), "", startIndex, pageSize);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]));
        }