Example #1
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (TxtExecutionTime.Text == "")
            {
                function.WriteErrMsg("启用时间不能为空");
            }
            int id = Convert.ToInt32(base.Request.QueryString["DevID"]);

            //this.HdnDevId.Value = id;
            if (id == 0)
            {
                info.ID            = DataConverter.CLng(this.HdnDevId.Value);
                info.PlanName      = this.TxtPlanName.Text;
                info.PlanRule      = this.TxtPlanRule.SelectedItem.Value;
                info.DataSet       = this.DR_Data.SelectedItem.Value;
                info.ExecutionTime = Convert.ToDateTime(this.TxtExecutionTime.Text);
                info.Description   = this.TxtDescription.Text;
                bll.insert(info);
                function.WriteSuccessMsg("添加成功!", "DevelopmentCenter.aspx");
            }
            else
            {
                info               = bll.SelReturnModel(id);
                info.PlanName      = this.TxtPlanName.Text;
                info.PlanRule      = this.TxtPlanRule.SelectedItem.Value;
                info.DataSet       = this.DR_Data.SelectedItem.Value;
                info.ExecutionTime = Convert.ToDateTime(this.TxtExecutionTime.Text);
                info.Description   = this.TxtDescription.Text;
                bll.UpdateByID(info);
                function.WriteSuccessMsg("修改成功!", "DevelopmentCenter.aspx");
            }
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindRule();
         BindData();
         int id = Convert.ToInt32(base.Request.QueryString["DevID"]);
         if (id != 0)
         {
             info = bll.SelReturnModel(id);
             this.TxtPlanName.Text          = info.PlanName;
             this.TxtPlanRule.SelectedValue = info.PlanRule;
             this.DR_Data.SelectedValue     = info.DataSet;
             this.TxtExecutionTime.Text     = Convert.ToString(info.ExecutionTime);
             this.TxtDescription.Text       = info.Description;
         }
         Call.SetBreadCrumb(Master, "<li>扩展功能</li><li><a href='RunSql.aspx'>开发中心</a></li><li>快速建表</li>");
     }
 }
        /// <summary>
        /// 合併wf派車單
        /// </summary>
        /// <returns></returns>
        public static string MergePlan(List <MergePlanModel> M_PlanModel)
        {
            string rst     = "success";
            var    Now     = DateTime.Now;
            int    success = 0;

            List <M_Plan>          PlanList      = new List <M_Plan>();
            List <D_PassengerList> PassengerList = new List <D_PassengerList>();
            var PlanID      = GetPlanNo();
            var LastUpdDate = "";
            var CreateDate  = "";
            var NewRid      = Guid.NewGuid().ToString();

            using (var db = new VehicleEntities())
            {
                foreach (var item in M_PlanModel)
                {
                    var changePlanModel = db.M_Plan.Where(t => t.planID == item.PlanID).FirstOrDefault();
                    LastUpdDate = changePlanModel.LastUpdDate.ToString();
                    CreateDate  = changePlanModel.CreateDate.ToString();
                }


                foreach (var item in M_PlanModel)
                {
                    var changePlanModel = db.M_Plan.Where(t => t.planID == item.PlanID).FirstOrDefault();

                    M_Plan Planitem = new M_Plan();
                    Planitem.RID = Guid.NewGuid().ToString();

                    Planitem.batch       = changePlanModel.batch;
                    Planitem.carID       = changePlanModel.carID;
                    Planitem.LastUpdUser = changePlanModel.LastUpdUser;
                    Planitem.CreateUser  = changePlanModel.CreateUser;
                    Planitem.driverID    = changePlanModel.driverID;
                    Planitem.driverTel   = changePlanModel.driverTel;
                    Planitem.time        = changePlanModel.time;
                    Planitem.status      = changePlanModel.status;
                    Planitem.step        = changePlanModel.step;
                    Planitem.LastUpdDate = Convert.ToDateTime(LastUpdDate);
                    Planitem.CreateDate  = Convert.ToDateTime(CreateDate);
                    Planitem.planID      = PlanID;
                    Planitem.valid       = "0";
                    PlanList.Add(Planitem);



                    var PassengerModel = db.D_PassengerList.Where(t => t.planID == item.PlanID);
                    foreach (var Passger_Item in PassengerModel)
                    {
                        D_PassengerList itemList = new D_PassengerList();
                        itemList.RID           = Guid.NewGuid().ToString();
                        itemList.planID        = PlanID;
                        itemList.locationID    = Passger_Item.locationID;
                        itemList.confirmTime   = Passger_Item.confirmTime;
                        itemList.destinationID = Passger_Item.destinationID;
                        itemList.passengerID   = Passger_Item.passengerID;
                        itemList.returnTime    = Passger_Item.returnTime;
                        itemList.PlanRID       = NewRid;
                        itemList.remark        = Passger_Item.remark;
                        itemList.status        = Passger_Item.status;
                        itemList.time          = Passger_Item.time;

                        PassengerList.Add(itemList);
                    }
                }

                foreach (var item in M_PlanModel)
                {
                    var PlanModel = db.M_Plan.Where(t => t.planID == item.PlanID).FirstOrDefault();
                    db.DeleteObject(PlanModel);

                    var PassengerModel = db.D_PassengerList.Where(t => t.planID == item.PlanID);
                    foreach (var PassengerItem in PassengerModel)
                    {
                        if (item.PlanID == PassengerItem.planID)
                        {
                            db.DeleteObject(PassengerItem);
                        }
                    }
                }



                foreach (var addPlanitem in PlanList)
                {
                    db.AddToM_Plan(addPlanitem);
                }

                foreach (var adPassengerditem in PassengerList)
                {
                    db.AddToD_PassengerList(adPassengerditem);
                }



                var YearText = DateTime.Now.ToString("yyyyMMdd").Substring(2, 2);
                int?number   = null;
                var List     = db.T_SystemApply.Where(t => t.FunctionName == "PlanNo" && t.DateTime == YearText);
                if (List.Count() > 0)
                {
                    var num = List.Max(t => t.Number);
                    //number = List.OrderByDescending(t => t.Create_Date).First().Number;
                    number = num + 1;
                }
                else
                {
                    number = 1;
                }
                //存儲單號記錄
                T_SystemApply SystemApply = new T_SystemApply();
                SystemApply.Create_Date  = DateTime.Now;
                SystemApply.DateTime     = Now.ToString("yyyy-MM-dd").Substring(2, 2);
                SystemApply.Number       = number;
                SystemApply.FunctionName = "PlanNo";
                SystemApply.RID          = Guid.NewGuid().ToString();
                db.AddToT_SystemApply(SystemApply);

                success = db.SaveChanges();
            }

            var modelRID = "";

            using (var db = new VehicleEntities())
            {
                var model = db.M_Plan.Where(t => t.planID == PlanID).FirstOrDefault();
                modelRID = model.RID;
                var demodel = db.D_PassengerList.Where(t => t.planID == PlanID);
                foreach (var deitem in demodel)
                {
                    deitem.PlanRID = modelRID;
                }
                db.SaveChanges();
            }

            using (var db = new VehicleEntities())
            {
                var modelPlanvalid = db.M_Plan.Where(t => t.RID == modelRID).FirstOrDefault();
                modelPlanvalid.valid  = "1";
                modelPlanvalid.IsSend = "0";
                db.SaveChanges();
            }

            if (success > 0)
            {
                return(rst);
            }
            else
            {
                rst = "fail";
                return(rst);
            }
        }
        /// <summary>
        /// 新增存儲
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="LoginUserID"></param>
        /// <returns></returns>
        public static string PlanAddSave(PlanModel PlanModel, List <PassengerModel> PassengerModel, List <stepModel> stepModel, string LoginUserID)
        {
            var ToDay = DateTime.Now.ToString("yyyy-MM-dd");

            using (var db = new VehicleEntities())
            {
                var    Rid           = Guid.NewGuid().ToString();
                var    PlanID        = GetPlanNo();
                var    stepLen_b     = stepModel.Count;
                var    stepLen       = stepLen_b - 1;
                string LocationID    = "";
                string DestinationID = "";

                foreach (var item in stepModel)
                {
                    if (item.sequence == 0)
                    {
                        LocationID = item.locationID;
                    }
                    if (item.sequence == stepLen)
                    {
                        DestinationID = item.locationID;
                    }
                }

                //存儲主檔
                M_Plan Plan = new M_Plan();
                Plan.RID           = Rid;
                Plan.planID        = PlanID;
                Plan.carID         = PlanModel.carID;
                Plan.driverID      = PlanModel.driverID;
                Plan.driverTel     = PlanModel.driverTel;
                Plan.locationID    = LocationID;
                Plan.destinationID = DestinationID;
                Plan.time          = Convert.ToDateTime(PlanModel.time);
                Plan.status        = Convert.ToInt32(PlanModel.status);
                Plan.step          = 0;
                Plan.CreateDate    = Convert.ToDateTime(PlanModel.CreateDate);
                Plan.CreateUser    = LoginUserID;
                Plan.LastUpdDate   = Convert.ToDateTime(PlanModel.CreateDate);
                Plan.LastUpdUser   = LoginUserID;
                Plan.valid         = "1";
                Plan.IsSend        = "0";
                Plan.batch         = PlanID;
                db.AddToM_Plan(Plan);

                //存儲站點表
                foreach (var item in stepModel)
                {
                    D_RoadList RoadList = new D_RoadList();
                    RoadList.RID        = item.RID;
                    RoadList.PlanRID    = Rid;
                    RoadList.planID     = PlanID;
                    RoadList.locationID = Convert.ToInt32(item.locationID);
                    RoadList.sequence   = item.sequence;
                    db.AddToD_RoadList(RoadList);
                }

                //存儲乘客表
                foreach (var item in PassengerModel)
                {
                    D_PassengerList PassengerList = new D_PassengerList();
                    PassengerList.RID           = item.RID;
                    PassengerList.PlanRID       = Rid;
                    PassengerList.planID        = PlanID;
                    PassengerList.passengerID   = item.passengerID;
                    PassengerList.time          = Convert.ToDateTime(item.time);
                    PassengerList.status        = item.status;
                    PassengerList.remark        = item.remark;
                    PassengerList.returnTime    = "";
                    PassengerList.locationID    = item.locationID;
                    PassengerList.destinationID = item.destinationID;

                    db.AddToD_PassengerList(PassengerList);
                }

                var YearText = DateTime.Now.ToString("yyyyMMdd").Substring(2, 2);
                int?number   = null;
                var List     = db.T_SystemApply.Where(t => t.FunctionName == "PlanNo" && t.DateTime == YearText);
                if (List.Count() > 0)
                {
                    var num = List.Max(t => t.Number);
                    //number = List.OrderByDescending(t => t.Create_Date).First().Number;
                    number = num + 1;
                }
                else
                {
                    number = 1;
                }

                //存儲單號記錄
                T_SystemApply SystemApply = new T_SystemApply();
                SystemApply.Create_Date  = DateTime.Now;
                SystemApply.DateTime     = PlanModel.CreateDate.ToString("yyyy-MM-dd").Substring(2, 2);
                SystemApply.Number       = number;
                SystemApply.FunctionName = "PlanNo";
                SystemApply.RID          = Guid.NewGuid().ToString();
                db.AddToT_SystemApply(SystemApply);

                int success = db.SaveChanges();
                if (success > 0)
                {
                    //在這寫
                    ViewModel.Result result = new Result();
                    result.success = true;
                    result.message = "提交保存成功";
                    WeChatWS.WeChatWSSoapClient ws = new WeChatWS.WeChatWSSoapClient();
                    ws.seedsmsToDriver(Rid);
                    using (var plan = new VehicleEntities())
                    {
                        var rst = plan.M_Plan.Where(t => t.RID == Rid).FirstOrDefault();
                        rst.IsSend = "1";
                        plan.SaveChanges();
                    }
                    return(JsonConvert.SerializeObject(result));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new ViewModel.Result()
                    {
                        success = true, message = "保存失败"
                    }));
                }
            }
        }
Example #5
0
        /// <summary>
        ///添加记录
        /// </summary>
        /// <param name="Sensitivity"></param>
        /// <returns></returns>

        public int insert(M_Plan model)
        {
            return(DBCenter.Insert(model));
        }
Example #6
0
 /// <summary>
 /// 根据ID更新
 /// </summary>
 public bool UpdateByID(M_Plan model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }
Example #7
0
        /// <summary>
        ///添加记录
        /// </summary>
        /// <param name="Sensitivity"></param>
        /// <returns></returns>

        public int insert(M_Plan model)
        {
            return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
        }
Example #8
0
 /// <summary>
 /// 根据ID更新
 /// </summary>
 public bool UpdateByID(M_Plan model)
 {
     return(Sql.UpdateByID(strTableName, PK, model.ID, BLLCommon.GetFieldAndPara(model), model.GetParameters()));
 }