Ejemplo n.º 1
0
        public int AddDayPlanInfo(DayPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TAB_DayPlan_TrainRelation");
            strSql.Append("(strDayPlanGUID,dtBeginTime,dtEndTime,dtCreateTime,strTrainNo,strTrainTypeName,strTrainNumber,strRemark,strTrainNo1,strTrainInfo,strTrainNo2,nQuDuanID,nPlanID,bIsTomorrow,nDayPlanID,nPlanState,strDaWenCheXing,strDaWenCheHao1,strDaWenCheHao2,strDaWenCheHao3,bIsSend,strTrainPlanGUID)");
            strSql.Append("values(@strDayPlanGUID,@dtBeginTime,@dtEndTime,@dtCreateTime,@strTrainNo,@strTrainTypeName,@strTrainNumber,@strRemark,@strTrainNo1,@strTrainInfo,@strTrainNo2,@nQuDuanID,@nPlanID,@bIsTomorrow,@nDayPlanID,@nPlanState,@strDaWenCheXing,@strDaWenCheHao1,@strDaWenCheHao2,@strDaWenCheHao3,@bIsSend,@strTrainPlanGUID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strDayPlanGUID",   model.strDayPlanGUID),
                new SqlParameter("@dtBeginTime",      model.dtBeginTime),
                new SqlParameter("@dtEndTime",        model.dtEndTime),
                new SqlParameter("@dtCreateTime",     model.dtCreateTime),
                new SqlParameter("@strTrainNo",       model.strTrainNo),
                new SqlParameter("@strTrainTypeName", model.strTrainTypeName),
                new SqlParameter("@strTrainNumber",   model.strTrainNumber),
                new SqlParameter("@strRemark",        model.strRemark),
                new SqlParameter("@strTrainNo1",      model.strTrainNo1),
                new SqlParameter("@strTrainInfo",     model.strTrainInfo),
                new SqlParameter("@strTrainNo2",      model.strTrainNo2),
                new SqlParameter("@nQuDuanID",        model.nQuDuanID),
                new SqlParameter("@nPlanID",          model.nPlanID),
                new SqlParameter("@bIsTomorrow",      model.bIsTomorrow),
                new SqlParameter("@nDayPlanID",       model.nDayPlanID),
                new SqlParameter("@nPlanState",       model.nPlanState),
                new SqlParameter("@strDaWenCheXing",  model.strDaWenCheXing),
                new SqlParameter("@strDaWenCheHao1",  model.strDaWenCheHao1),
                new SqlParameter("@strDaWenCheHao2",  model.strDaWenCheHao2),
                new SqlParameter("@strDaWenCheHao3",  model.strDaWenCheHao3),
                new SqlParameter("@bIsSend",          model.bIsSend),
                new SqlParameter("@strTrainPlanGUID", model.strTrainPlanGUID)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters));
        }
Ejemplo n.º 2
0
        public Get_OutGetPlan GetPlan(string data)
        {
            Get_OutGetPlan json = new Get_OutGetPlan();

            try
            {
                Get_InGetPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGetPlan>(data);
                DBDayPlan     db    = new DBDayPlan();
                resultGetPlan r     = new resultGetPlan();
                r.bExist = false;
                DayPlan Plan = new DayPlan();
                if (db.GetPlan(input.PlanGUID, Plan))
                {
                    r.bExist = true;
                    r.Plan   = Plan;
                }

                json.data      = r;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
Ejemplo n.º 3
0
 public DayPlan QueryPlans_DRToModel(DataRow dr, DayPlan Plan)
 {
     if (dr != null)
     {
         Plan.strDayPlanGUID   = ObjectConvertClass.static_ext_string(dr["strDayPlanGUID"]);
         Plan.dtBeginTime      = ObjectConvertClass.static_ext_date(dr["dtBeginTime"]);
         Plan.dtEndTime        = ObjectConvertClass.static_ext_date(dr["dtEndTime"]);
         Plan.dtCreateTime     = ObjectConvertClass.static_ext_date(dr["dtCreateTime"]);
         Plan.strTrainNo       = ObjectConvertClass.static_ext_string(dr["strTrainNo"]);
         Plan.strTrainTypeName = ObjectConvertClass.static_ext_string(dr["strTrainTypeName"]);
         Plan.strTrainNumber   = ObjectConvertClass.static_ext_string(dr["strTrainNumber"]);
         Plan.nid              = ObjectConvertClass.static_ext_int(dr["nid"]);
         Plan.strRemark        = ObjectConvertClass.static_ext_string(dr["strRemark"]);
         Plan.strTrainNo1      = ObjectConvertClass.static_ext_string(dr["strTrainNo1"]);
         Plan.strTrainInfo     = ObjectConvertClass.static_ext_string(dr["strTrainInfo"]);
         Plan.strTrainNo2      = ObjectConvertClass.static_ext_string(dr["strTrainNo2"]);
         Plan.nQuDuanID        = ObjectConvertClass.static_ext_int(dr["nQuDuanID"]);
         Plan.nPlanID          = ObjectConvertClass.static_ext_int(dr["nPlanID"]);
         Plan.bIsTomorrow      = ObjectConvertClass.static_ext_int(dr["bIsTomorrow"]);
         Plan.nDayPlanID       = ObjectConvertClass.static_ext_int(dr["nDayPlanID"]);
         Plan.nPlanState       = ObjectConvertClass.static_ext_int(dr["nPlanState"]);
         Plan.strDaWenCheXing  = ObjectConvertClass.static_ext_string(dr["strDaWenCheXing"]);
         Plan.strDaWenCheHao1  = ObjectConvertClass.static_ext_string(dr["strDaWenCheHao1"]);
         Plan.strDaWenCheHao2  = ObjectConvertClass.static_ext_string(dr["strDaWenCheHao2"]);
         Plan.strDaWenCheHao3  = ObjectConvertClass.static_ext_string(dr["strDaWenCheHao3"]);
         Plan.bIsSend          = ObjectConvertClass.static_ext_int(dr["bIsSend"]);
         Plan.strTrainPlanGUID = ObjectConvertClass.static_ext_string(dr["strTrainPlanGUID"]);
     }
     return(Plan);
 }
Ejemplo n.º 4
0
        public int LoadDayPlanInfo(DateTime DayPlanDate, DateTime dtNow, int DayPlanTypeID, int DayPlanID, int GroupID, DataTable dt)
        {
            DateTime dtBeginTime, dtEndTime;
            DayPlan  dp = new DayPlan();
            int      k  = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dp.strDayPlanGUID = Guid.NewGuid().ToString();
                dp.nPlanState     = 1;
                DateTime DayPlanDate_Day = Convert.ToDateTime(DayPlanDate.ToShortDateString());
                if (DayPlanTypeID == 0)  //白班
                {
                    dtBeginTime = DayPlanDate_Day.AddHours(8);
                    dtEndTime   = DayPlanDate_Day.AddHours(18).AddSeconds(-1);
                }
                else if (DayPlanTypeID == 1)  //夜班
                {
                    dtBeginTime = DayPlanDate_Day.AddHours(18);
                    dtEndTime   = DayPlanDate_Day.AddDays(1).AddHours(8).AddSeconds(-1);
                }
                else //全天
                {
                    dtBeginTime = DayPlanDate_Day.AddHours(18);
                    dtEndTime   = DayPlanDate_Day.AddDays(1).AddHours(18).AddSeconds(-1);
                }
                dp.dtBeginTime      = dtBeginTime;                           //开始时间
                dp.dtEndTime        = dtEndTime;                             //结束时间
                dp.dtCreateTime     = dtNow;                                 //产生事件
                dp.strTrainNo1      = dt.Rows[i]["strTrainNo1"].ToString();  //车次1
                dp.strTrainInfo     = dt.Rows[i]["strTrainInfo"].ToString(); //机车信息
                dp.strTrainNo2      = dt.Rows[i]["strTrainNo2"].ToString();  //车次 2
                dp.strTrainNo       = dt.Rows[i]["strTrainNo"].ToString();   //车次
                dp.strTrainTypeName = "";                                    //车型
                dp.strTrainNumber   = "";                                    //车号
                dp.strRemark        = dt.Rows[i]["strRemark"].ToString();

                if (Convert.ToInt32(dt.Rows[i]["bIsTomorrow"]) > 0)
                {
                    dp.strRemark = DayPlanDate_Day.AddDays(1).ToString() + "日";
                }
                dp.bIsTomorrow = Convert.ToInt32(dt.Rows[i]["bIsTomorrow"]);
                dp.nDayPlanID  = DayPlanID;
                dp.nQuDuanID   = Convert.ToInt32(dt.Rows[i]["nGroupID"]);   //区段信息
                //打温专用
                dp.strDaWenCheXing  = dt.Rows[i]["strDaWenCheXing"].ToString();
                dp.strDaWenCheHao1  = dt.Rows[i]["strDaWenCheHao1"].ToString();
                dp.strDaWenCheHao2  = dt.Rows[i]["strDaWenCheHao2"].ToString();
                dp.strDaWenCheHao3  = dt.Rows[i]["strDaWenCheHao3"].ToString();
                dp.nPlanID          = Convert.ToInt32(dt.Rows[i]["nID"].ToString());
                dp.bIsSend          = 0;
                dp.strTrainPlanGUID = "";
                k += AddDayPlanInfo(dp);
            }
            return(k);
        }
Ejemplo n.º 5
0
        public int ModifyDayPlanInfo(DayPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update TAB_DayPlan_TrainRelation set ");
            strSql.Append(" dtBeginTime = @dtBeginTime, ");
            strSql.Append(" dtEndTime = @dtEndTime, ");
            strSql.Append(" dtCreateTime = @dtCreateTime, ");
            strSql.Append(" strTrainNo = @strTrainNo, ");
            strSql.Append(" strTrainTypeName = @strTrainTypeName, ");
            strSql.Append(" strTrainNumber = @strTrainNumber, ");
            strSql.Append(" strRemark = @strRemark, ");
            strSql.Append(" strTrainNo1 = @strTrainNo1, ");
            strSql.Append(" strTrainInfo = @strTrainInfo, ");
            strSql.Append(" strTrainNo2 = @strTrainNo2, ");
            strSql.Append(" nQuDuanID = @nQuDuanID, ");
            strSql.Append(" nPlanID = @nPlanID, ");
            strSql.Append(" bIsTomorrow = @bIsTomorrow, ");
            strSql.Append(" nDayPlanID = @nDayPlanID, ");
            strSql.Append(" nPlanState = @nPlanState, ");
            strSql.Append(" strDaWenCheXing = @strDaWenCheXing, ");
            strSql.Append(" strDaWenCheHao1 = @strDaWenCheHao1, ");
            strSql.Append(" strDaWenCheHao2 = @strDaWenCheHao2, ");
            strSql.Append(" strDaWenCheHao3 = @strDaWenCheHao3, ");
            strSql.Append(" bIsSend = @bIsSend, ");
            strSql.Append(" strTrainPlanGUID = @strTrainPlanGUID ");
            strSql.Append(" where strDayPlanGUID = @strDayPlanGUID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@strDayPlanGUID",   model.strDayPlanGUID),
                new SqlParameter("@dtBeginTime",      model.dtBeginTime),
                new SqlParameter("@dtEndTime",        model.dtEndTime),
                new SqlParameter("@dtCreateTime",     model.dtCreateTime),
                new SqlParameter("@strTrainNo",       model.strTrainNo),
                new SqlParameter("@strTrainTypeName", model.strTrainTypeName),
                new SqlParameter("@strTrainNumber",   model.strTrainNumber),
                new SqlParameter("@strRemark",        model.strRemark),
                new SqlParameter("@strTrainNo1",      model.strTrainNo1),
                new SqlParameter("@strTrainInfo",     model.strTrainInfo),
                new SqlParameter("@strTrainNo2",      model.strTrainNo2),
                new SqlParameter("@nQuDuanID",        model.nQuDuanID),
                new SqlParameter("@nPlanID",          model.nPlanID),
                new SqlParameter("@bIsTomorrow",      model.bIsTomorrow),
                new SqlParameter("@nDayPlanID",       model.nDayPlanID),
                new SqlParameter("@nPlanState",       model.nPlanState),
                new SqlParameter("@strDaWenCheXing",  model.strDaWenCheXing),
                new SqlParameter("@strDaWenCheHao1",  model.strDaWenCheHao1),
                new SqlParameter("@strDaWenCheHao2",  model.strDaWenCheHao2),
                new SqlParameter("@strDaWenCheHao3",  model.strDaWenCheHao3),
                new SqlParameter("@bIsSend",          model.bIsSend),
                new SqlParameter("@strTrainPlanGUID", model.strTrainPlanGUID)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters));
        }
Ejemplo n.º 6
0
        public bool GetPlan(string PlanGUID, DayPlan Plan)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * from TAB_DayPlan_TrainRelation where  strDayPlanGUID ='" + PlanGUID + "'");
            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString()).Tables[0];

            if (dt.Rows.Count <= 0)
            {
                return(false);
            }
            QueryPlans_DRToModel(dt.Rows[0], Plan);

            return(true);
        }
Ejemplo n.º 7
0
        public List <DayPlan> QueryPlans_DTToList(DataTable dt)
        {
            List <DayPlan> modelList = new List <DayPlan>();
            int            rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int n = 0; n < rowsCount; n++)
                {
                    DayPlan model = new DayPlan();
                    QueryPlans_DRToModel(dt.Rows[n], model);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return(modelList);
        }