예제 #1
0
        public string Delsignplan(string input)
        {
            DelJsonModel jsonModel = new DelJsonModel();

            TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation();
            try
            {
                DelSinPlan paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <DelSinPlan>(input);

                AddPlanSign     bllSignPlan = new AddPlanSign();
                Modal_Plan_Rest PlanSign    = new Modal_Plan_Rest();
                strSignPlans    t           = new strSignPlans();
                if (bllSignPlan.DelParamModel(paramModel.strGUID) != 0)
                {
                    t.strSignPlan       = "删除成功";
                    jsonModel.result    = 0;
                    jsonModel.resultStr = "返回成功";
                    jsonModel.data      = t;
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交失败" + ex.Message;
            }
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel);

            return(result);
        }
예제 #2
0
        public void checkIsLeave(Modal_Plan_Rest model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" select strTrainmanGUID from TAB_Org_Trainman where nTrainmanState = 0  ");
            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString()).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["strTrainmanGUID"].ToString() == model.strTrainmanGUID1)
                {
                    throw new Exception("人员处于非运转状态,不能签点!");
                }
                if (dt.Rows[i]["strTrainmanGUID"].ToString() == model.strTrainmanGUID2)
                {
                    throw new Exception("人员处于非运转状态,不能签点!");
                }
                if (dt.Rows[i]["strTrainmanGUID"].ToString() == model.strTrainmanGUID3)
                {
                    throw new Exception("人员处于非运转状态,不能签点!");
                }
                if (dt.Rows[i]["strTrainmanGUID"].ToString() == model.strTrainmanGUID4)
                {
                    throw new Exception("人员处于非运转状态,不能签点!");
                }
            }


            if (!string.IsNullOrEmpty(model.strTrainmanGUID1))
            {
            }
        }
예제 #3
0
        public OutAddSignPlan Addsignplan(string input)
        {
            OutAddSignPlan jsonModel = new OutAddSignPlan();

            TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation();
            try
            {
                TF.RunSafty.Model.InterfaceModel.PlanSign paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <TF.RunSafty.Model.InterfaceModel.PlanSign>(input);
                //验证数据正确性,非空字段不能为空

                AddPlanSign     bllSignPlan = new AddPlanSign();
                Modal_Plan_Rest PlanSign    = new Modal_Plan_Rest();
                DataAddSignPlan t           = new DataAddSignPlan();
                if (bllSignPlan.AddByParamModel(paramModel, PlanSign) != 0)
                {
                    t.SignPlanGUID      = PlanSign.strGUID;
                    jsonModel.result    = 0;
                    jsonModel.resultStr = "返回成功";
                    jsonModel.data      = t;
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交失败" + ex.Message;
            }
            return(jsonModel);
        }
예제 #4
0
        public bool UpdateByParamModel(TF.RunSafty.Model.InterfaceModel.PlanRestModels paramModel, string IsOrNotIndexes)
        {
            Modal_Plan_Rest Plan_Rest = this.GetModel(paramModel.strguid);

            SetModelValue(paramModel, Plan_Rest);

            if (IsOrNotIndexes == "")
            {
                return(this.Update(Plan_Rest));
            }
            else
            {
                return(this.UpdateAndFirst(Plan_Rest, Plan_Rest.strTrainJiaoLuGUID));
            }
        }
예제 #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int UpdatePlan(Modal_Plan_Rest model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TAB_Plan_Sign set ");
            strSql.Append("dtArriveTime=@dtArriveTime,");
            strSql.Append("dtCallTime=@dtCallTime,");
            strSql.Append("strTrainNo=@strTrainNo,");
            strSql.Append("dtChuQinTime=@dtChuQinTime,");
            strSql.Append("strTrainJiaoLuGUID=@strTrainJiaoLuGUID,");
            strSql.Append("nNeedRest=@nNeedRest,");
            strSql.Append("dtStartTrainTime=@dtStartTrainTime");
            strSql.Append(" where strGUID=@strGUID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strGUID",            SqlDbType.VarChar,   50),
                new SqlParameter("@dtArriveTime",       SqlDbType.DateTime),
                new SqlParameter("@dtCallTime",         SqlDbType.DateTime),
                new SqlParameter("@strTrainNo",         SqlDbType.VarChar,   50),
                new SqlParameter("@dtChuQinTime",       SqlDbType.DateTime),
                new SqlParameter("@strTrainJiaoLuGUID", SqlDbType.VarChar,   50),
                new SqlParameter("@nNeedRest",          SqlDbType.Int,        4),
                new SqlParameter("@dtStartTrainTime",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.strGUID;
            parameters[1].Value = model.dtArriveTime;
            parameters[2].Value = model.dtCallTime;
            parameters[3].Value = model.strTrainNo;
            parameters[4].Value = model.dtChuQinTime;
            parameters[5].Value = model.strTrainJiaoLuGUID;
            parameters[6].Value = model.nNeedRest;
            parameters[7].Value = model.dtStartTrainTime;

            int rows1 = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);



            if (rows1 > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
예제 #6
0
        public List <Modal_Plan_Rest> GetPlaceList(List <Modal_Plan_Rest> placeList)
        {
            if (placeList != null)
            {
                List <Modal_Plan_Rest> resultList = new List <Modal_Plan_Rest>();
                foreach (Modal_Plan_Rest place in placeList)
                {
                    Modal_Plan_Rest model = new Modal_Plan_Rest();
                    model.dtArriveTime       = place.dtArriveTime;
                    model.dtCallTime         = place.dtCallTime;
                    model.nID                = place.nID;
                    model.strGUID            = place.strGUID;
                    model.strTrainJiaoLuGUID = place.strTrainJiaoLuGUID;
                    model.strTrainmanGUID1   = place.strTrainmanGUID1;
                    model.strTrainmanGUID2   = place.strTrainmanGUID2;
                    model.strTrainmanGUID3   = place.strTrainmanGUID3;
                    model.strTrainmanGUID4   = place.strTrainmanGUID4;
                    model.strTrainNoGUID     = place.strTrainNoGUID;
                    model.strWorkGrouGUID    = place.strWorkGrouGUID;
                    model.strTrainNo         = place.strTrainNo;
                    model.dtChuQinTime       = place.dtChuQinTime;
                    model.dtStartTrainTime   = place.dtStartTrainTime;
                    model.dtSignTime         = place.dtSignTime;
                    model.ePlanState         = place.ePlanState;
                    model.nNeedRest          = place.nNeedRest;
                    model.nFinished          = place.nFinished;
                    model.strTrainmanName1   = place.strTrainmanName1;
                    model.strTrainmanName2   = place.strTrainmanName2;
                    model.strTrainmanName3   = place.strTrainmanName3;
                    model.strTrainmanName4   = place.strTrainmanName4;

                    model.strTrainmanNumber1 = place.strTrainmanNumber1;
                    model.strTrainmanNumber2 = place.strTrainmanNumber2;
                    model.strTrainmanNumber3 = place.strTrainmanNumber3;
                    model.strTrainmanNumber4 = place.strTrainmanNumber4;
                    resultList.Add(model);
                }
                return(resultList);
            }
            return(null);
        }
예제 #7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddPlan(Modal_Plan_Rest model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TAB_Plan_Sign(");
            strSql.Append("strGUID,dtArriveTime,dtCallTime,dtChuQinTime,strTrainNo,strTrainJiaoLuGUID,nNeedRest,dtStartTrainTime)");
            strSql.Append(" values (");
            strSql.Append("@strGUID,@dtArriveTime,@dtCallTime,@dtChuQinTime,@strTrainNo,@strTrainJiaoLuGUID,@nNeedRest,@dtStartTrainTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strGUID",            SqlDbType.VarChar, 50),
                new SqlParameter("@dtArriveTime",       SqlDbType.VarChar, 50),
                new SqlParameter("@dtCallTime",         SqlDbType.VarChar, 50),
                new SqlParameter("@dtChuQinTime",       SqlDbType.VarChar, 50),
                new SqlParameter("@strTrainNo",         SqlDbType.VarChar, 50),
                new SqlParameter("@strTrainJiaoLuGUID", SqlDbType.VarChar, 50),
                new SqlParameter("@nNeedRest",          SqlDbType.Int,      4),
                new SqlParameter("@dtStartTrainTime",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.strGUID;
            parameters[1].Value = model.dtArriveTime;
            parameters[2].Value = model.dtCallTime;
            parameters[3].Value = model.dtChuQinTime;
            parameters[4].Value = model.strTrainNo;
            parameters[5].Value = model.strTrainJiaoLuGUID;
            parameters[6].Value = model.nNeedRest;
            parameters[7].Value = model.dtStartTrainTime;

            int rows = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
예제 #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Modal_Plan_Rest GetModel(string strGUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from TAB_Plan_Sign ");
            strSql.Append(" where strGUID=@strGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strGUID", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = strGUID;

            Modal_Plan_Rest model = new Modal_Plan_Rest();
            DataSet         ds    = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #9
0
        ///// <summary>
        ///// 增加一条数据
        ///// </summary>
        //public int AddPlanTrain(TF.RunSafty.Model.TAB_Plan_Train model)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("insert into TAB_Plan_Train(");
        //    strSql.Append("strTrainNo,dtChuQinTime,nNeedRest,dtArriveTime,dtCallTime,nDragType,nKehuoID,nPlanType,nRemarkType,nTrainmanTypeID,strTrainJiaoluGUID,strTrainTypeName,dtStartTime,dtFirstStartTime,dtRealStartTime,nPlanState,strPlaceID,strStartStation,strEndStation,strRemark,strTrainNumber,strCreateSiteGUID,strCreateUserGUID");
        //    strSql.Append(") values (");
        //    strSql.Append("@strTrainNo,@dtChuQinTime,@nNeedRest,@dtArriveTime,@dtCallTime,@nDragType,@nKehuoID,@nPlanType,@nRemarkType,@nTrainmanTypeID,@strTrainJiaoluGUID,@strTrainTypeName,@dtStartTime,@dtFirstStartTime,@dtRealStartTime,@nPlanState,@strPlaceID,@strStartStation,@strEndStation,@strRemark,@strTrainNumber,@strCreateSiteGUID,@strCreateUserGUID");
        //    strSql.Append(") ");
        //    SqlParameter[] parameters = {
        //                new SqlParameter("@strTrainNo", SqlDbType.VarChar,50) ,
        //                new SqlParameter("@dtChuQinTime", SqlDbType.DateTime) ,
        //                new SqlParameter("@dtArriveTime", SqlDbType.DateTime) ,
        //                new SqlParameter("@dtCallTime", SqlDbType.DateTime),
        //                new SqlParameter("@nDragType", SqlDbType.Int,4),
        //                new SqlParameter("@nKehuoID", SqlDbType.Int,4),
        //                new SqlParameter("@nNeedRest", SqlDbType.Int,4),
        //                new SqlParameter("@nPlanType", SqlDbType.Int,4),
        //                new SqlParameter("@nRemarkType", SqlDbType.Int,4),
        //                new SqlParameter("@nTrainmanTypeID", SqlDbType.Int,4),
        //                new SqlParameter("@strTrainJiaoluGUID", SqlDbType.VarChar,50),
        //                new SqlParameter("@strTrainTypeName", SqlDbType.VarChar,50),
        //                new SqlParameter("@dtStartTime", SqlDbType.DateTime),
        //                new SqlParameter("@dtFirstStartTime", SqlDbType.DateTime),
        //                new SqlParameter("@dtRealStartTime", SqlDbType.DateTime),
        //                new SqlParameter("@nPlanState", SqlDbType.Int,4),
        //                new SqlParameter("@strPlaceID", SqlDbType.VarChar,50),
        //                new SqlParameter("@strStartStation", SqlDbType.VarChar,50),
        //                new SqlParameter("@strEndStation", SqlDbType.VarChar,50),
        //                new SqlParameter("@strRemark", SqlDbType.VarChar,50),
        //                new SqlParameter("@strTrainNumber", SqlDbType.VarChar,50),
        //                new SqlParameter("@strCreateSiteGUID", SqlDbType.VarChar,50),
        //                new SqlParameter("@strCreateUserGUID", SqlDbType.VarChar,50)

        //    };
        //    parameters[0].Value = model.strTrainNo;
        //    parameters[1].Value = model.dtChuQinTime;
        //    parameters[2].Value = model.dtArriveTime;
        //    parameters[3].Value = model.dtCallTime;
        //    parameters[4].Value = model.nDragType;
        //    parameters[5].Value = model.nKehuoID;
        //    parameters[6].Value = model.nNeedRest;
        //    parameters[7].Value = model.nPlanType;
        //    parameters[8].Value = model.nRemarkType;
        //    parameters[9].Value = model.nTrainmanTypeID;
        //    parameters[10].Value = model.strTrainJiaoluGUID;
        //    parameters[11].Value = model.strTrainTypeName;
        //    parameters[12].Value = model.dtStartTime;
        //    parameters[13].Value = model.dtFirstStartTime;
        //    parameters[14].Value = model.dtRealStartTime;
        //    parameters[15].Value = model.nPlanState;
        //    parameters[16].Value = model.strPlaceID;
        //    parameters[17].Value = model.strStartStation;
        //    parameters[18].Value = model.strEndStation;
        //    parameters[19].Value = model.strRemark;
        //    parameters[20].Value = model.strTrainNumber;
        //    parameters[21].Value = model.strCreateSiteGUID;
        //    parameters[22].Value = model.strCreateUserGUID;

        //    int rows = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);
        //    if (rows > 0)
        //    {
        //        return 1;
        //    }
        //    else
        //    {
        //        return 0;
        //    }
        //}


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Modal_Plan_Rest DataRowToModel2(DataRow row)
        {
            Modal_Plan_Rest model = new Modal_Plan_Rest();

            if (row != null)
            {
                if (row["nID"] != null && row["nID"].ToString() != "")
                {
                    model.nID = int.Parse(row["nID"].ToString());
                }
                if (row["strGUID"] != null)
                {
                    model.strGUID = row["strGUID"].ToString();
                }
                if (row["strTrainJiaoLuGUID"] != null)
                {
                    model.strTrainJiaoLuGUID = row["strTrainJiaoLuGUID"].ToString();
                }
                if (row["dtArriveTime"] != null && row["dtArriveTime"].ToString() != "1900-01-01 00:00:00")
                {
                    model.dtArriveTime = Convert.ToDateTime(row["dtArriveTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    model.dtArriveTime = "";
                }

                if (row["dtCallTime"] != null && row["dtCallTime"].ToString() != "1900-01-01 00:00:00")
                {
                    model.dtCallTime = Convert.ToDateTime(row["dtCallTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    model.dtCallTime = "";
                }

                if (row["strTrainNo"] != null)
                {
                    model.strTrainNo = row["strTrainNo"].ToString();
                }
                if (row["dtChuQinTime"] != null && row["dtChuQinTime"].ToString() != "")
                {
                    model.dtChuQinTime = Convert.ToDateTime(row["dtChuQinTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    model.dtChuQinTime = "";
                }


                if (row["strTrainNoGUID"] != null)
                {
                    model.strTrainNoGUID = row["strTrainNoGUID"].ToString();
                }
                if (row["strWorkGrouGUID"] != null)
                {
                    model.strWorkGrouGUID = row["strWorkGrouGUID"].ToString();
                }
                if (row["strTrainmanGUID1"] != null)
                {
                    model.strTrainmanGUID1 = row["strTrainmanGUID1"].ToString();
                }
                if (row["strTrainmanGUID2"] != null)
                {
                    model.strTrainmanGUID2 = row["strTrainmanGUID2"].ToString();
                }
                if (row["strTrainmanGUID3"] != null)
                {
                    model.strTrainmanGUID3 = row["strTrainmanGUID3"].ToString();
                }
                if (row["strTrainmanGUID4"] != null)
                {
                    model.strTrainmanGUID4 = row["strTrainmanGUID4"].ToString();
                }
                if (row["nNeedRest"] != null && row["nNeedRest"].ToString() != "")
                {
                    model.nNeedRest = int.Parse(row["nNeedRest"].ToString());
                }

                if (row["nFinished"] != null && row["nFinished"].ToString() != "")
                {
                    model.nFinished = int.Parse(row["nFinished"].ToString());
                }

                if (row["ePlanState"] != null && row["ePlanState"].ToString() != "")
                {
                    model.ePlanState = int.Parse(row["ePlanState"].ToString());
                }
                if (row["dtSignTime"] != null && row["dtSignTime"].ToString() != "" && row["dtSignTime"].ToString() != "1900-01-01 00:00:00")
                {
                    model.dtSignTime = Convert.ToDateTime(row["dtSignTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    model.dtSignTime = "";
                }
                if (row["dtStartTrainTime"] != null && row["dtStartTrainTime"].ToString() != "")
                {
                    model.dtStartTrainTime = Convert.ToDateTime(row["dtStartTrainTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    model.dtStartTrainTime = "";
                }


                if (row["strTrainmanName1"] != null && row["strTrainmanName1"].ToString() != "")
                {
                    model.strTrainmanName1 = row["strTrainmanName1"].ToString();
                }
                else
                {
                    model.strTrainmanName1 = "";
                }


                if (row["strTrainmanName2"] != null && row["strTrainmanName2"].ToString() != "")
                {
                    model.strTrainmanName2 = row["strTrainmanName2"].ToString();
                }
                else
                {
                    model.strTrainmanName2 = "";
                }
                if (row["strTrainmanName3"] != null && row["strTrainmanName3"].ToString() != "")
                {
                    model.strTrainmanName3 = row["strTrainmanName3"].ToString();
                }
                else
                {
                    model.strTrainmanName3 = "";
                }

                if (row["strTrainmanName4"] != null && row["strTrainmanName4"].ToString() != "")
                {
                    model.strTrainmanName4 = row["strTrainmanName4"].ToString();
                }
                else
                {
                    model.strTrainmanName4 = "";
                }

                if (row["strTrainmanNumber4"] != null && row["strTrainmanNumber4"].ToString() != "")
                {
                    model.strTrainmanNumber4 = row["strTrainmanNumber4"].ToString();
                }
                else
                {
                    model.strTrainmanNumber4 = "";
                }

                if (row["strTrainmanNumber3"] != null && row["strTrainmanNumber3"].ToString() != "")
                {
                    model.strTrainmanNumber3 = row["strTrainmanNumber3"].ToString();
                }
                else
                {
                    model.strTrainmanNumber3 = "";
                }

                if (row["strTrainmanNumber2"] != null && row["strTrainmanNumber2"].ToString() != "")
                {
                    model.strTrainmanNumber2 = row["strTrainmanNumber2"].ToString();
                }
                else
                {
                    model.strTrainmanNumber2 = "";
                }

                if (row["strTrainmanNumber1"] != null && row["strTrainmanNumber1"].ToString() != "")
                {
                    model.strTrainmanNumber1 = row["strTrainmanNumber1"].ToString();
                }
                else
                {
                    model.strTrainmanNumber1 = "";
                }
            }
            return(model);
        }
예제 #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool UpdateAndFirst(Modal_Plan_Rest model, string JiaoLuGUID)
 {
     return(dal.UpdateAndFirst(model, JiaoLuGUID));
 }
예제 #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Modal_Plan_Rest model)
 {
     //判断人员是否处于请假状态
     return(dal.Update(model));
 }
예제 #12
0
 //编辑
 public int Edit(Modal_Plan_Rest model)
 {
     return(dal.UpdatePlan(model));
 }
예제 #13
0
 public void SetModelValue(TF.RunSafty.Model.InterfaceModel.PlanSign paramModel, Modal_Plan_Rest PlanSign)
 {
     PlanSign.strGUID            = paramModel.strGUID;
     PlanSign.nNeedRest          = paramModel.nNeedRest;
     PlanSign.strTrainJiaoLuGUID = paramModel.strTrainJiaoLuGUID;
     PlanSign.strTrainNo         = paramModel.strTrainNo;
     PlanSign.dtArriveTime       = paramModel.dtArriveTime;
     PlanSign.dtCallTime         = paramModel.dtCallTime;
     PlanSign.dtChuQinTime       = paramModel.dtChuQinTime;
     PlanSign.dtStartTrainTime   = paramModel.dtStartTrainTime;
 }
예제 #14
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Modal_Plan_Rest DataRowToModel(DataRow row)
        {
            Modal_Plan_Rest model = new Modal_Plan_Rest();

            if (row != null)
            {
                if (row["nID"] != null && row["nID"].ToString() != "")
                {
                    model.nID = int.Parse(row["nID"].ToString());
                }
                if (row["strGUID"] != null)
                {
                    model.strGUID = row["strGUID"].ToString();
                }
                if (row["strTrainJiaoLuGUID"] != null)
                {
                    model.strTrainJiaoLuGUID = row["strTrainJiaoLuGUID"].ToString();
                }
                if (row["dtArriveTime"] != null && row["dtArriveTime"].ToString() != "1900-01-01 00:00:00")
                {
                    model.dtArriveTime = row["dtArriveTime"].ToString();
                }
                else
                {
                    model.dtArriveTime = "";
                }

                if (row["dtCallTime"] != null && row["dtCallTime"].ToString() != "1900-01-01 00:00:00")
                {
                    model.dtCallTime = row["dtCallTime"].ToString();
                }
                else
                {
                    model.dtCallTime = "";
                }

                if (row["strTrainNo"] != null)
                {
                    model.strTrainNo = row["strTrainNo"].ToString();
                }
                if (row["dtChuQinTime"] != null && row["dtChuQinTime"].ToString() != "")
                {
                    model.dtChuQinTime = row["dtChuQinTime"].ToString();
                }
                else
                {
                    model.dtChuQinTime = "";
                }


                if (row["strTrainNoGUID"] != null)
                {
                    model.strTrainNoGUID = row["strTrainNoGUID"].ToString();
                }
                if (row["strWorkGrouGUID"] != null)
                {
                    model.strWorkGrouGUID = row["strWorkGrouGUID"].ToString();
                }
                if (row["strTrainmanGUID1"] != null)
                {
                    model.strTrainmanGUID1 = row["strTrainmanGUID1"].ToString();
                }
                if (row["strTrainmanGUID2"] != null)
                {
                    model.strTrainmanGUID2 = row["strTrainmanGUID2"].ToString();
                }
                if (row["strTrainmanGUID3"] != null)
                {
                    model.strTrainmanGUID3 = row["strTrainmanGUID3"].ToString();
                }
                if (row["strTrainmanGUID4"] != null)
                {
                    model.strTrainmanGUID4 = row["strTrainmanGUID4"].ToString();
                }
                if (row["nNeedRest"] != null && row["nNeedRest"].ToString() != "")
                {
                    model.nNeedRest = int.Parse(row["nNeedRest"].ToString());
                }
                if (row["ePlanState"] != null && row["ePlanState"].ToString() != "")
                {
                    model.ePlanState = int.Parse(row["ePlanState"].ToString());
                }
                if (row["dtSignTime"] != null && row["dtSignTime"].ToString() != "")
                {
                    model.dtSignTime = row["dtSignTime"].ToString();
                }
                else
                {
                    model.dtSignTime = "";
                }
                if (row["dtStartTrainTime"] != null && row["dtStartTrainTime"].ToString() != "")
                {
                    model.dtStartTrainTime = row["dtStartTrainTime"].ToString();
                }
                else
                {
                    model.dtStartTrainTime = "";
                }
            }
            return(model);
        }
예제 #15
0
 public int EditParamModel(TF.RunSafty.Model.InterfaceModel.PlanSign paramModel, Modal_Plan_Rest PlanSign)
 {
     SetModelValue(paramModel, PlanSign);
     return(this.Edit(PlanSign));
 }
예제 #16
0
        public List <Modal_Plan_Rest> GetPlanTrain(string DtBeginDate, string DtEndDate, string strJiaoluGUID)
        {
            string dtNewDateBegin = "";
            string dtNewDateEnd   = "";


            dtNewDateBegin = Convert.ToDateTime(DtBeginDate).ToString("yyyy-MM-dd") + " 00:00:00";
            dtNewDateEnd   = Convert.ToDateTime(DtEndDate).ToString("yyyy-MM-dd") + " 00:00:00";


            TimeSpan dtsp   = Convert.ToDateTime(dtNewDateEnd) - Convert.ToDateTime(dtNewDateBegin);
            int      spDays = dtsp.Days + 1;

            Modal_Plan_Rest TPRModel = new Modal_Plan_Rest();
            DataTable       dt       = GetTuDingCheCi();

            for (int d = 0; d < spDays; d++)
            {
                string DtBeginDateTime = Convert.ToDateTime(dtNewDateBegin).AddDays(d).ToString("yyyy-MM-dd") + " 00:00:00";
                string DtEndDateTime   = Convert.ToDateTime(dtNewDateBegin).AddDays(d + 1).ToString("yyyy-MM-dd") + " 00:00:00";

                string strDtBeginDateTime = Convert.ToDateTime(DtBeginDateTime).ToString("yyyy-MM-dd");
                int    planCount          = dal.CountPlan(DtBeginDateTime, DtEndDateTime, strJiaoluGUID);
                if (planCount == 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //出勤时间
                        if (dt.Rows[i]["dtStartTime"].ToString() != "" && dt.Rows[i]["dtStartTime"] != null)
                        {
                            TPRModel.dtChuQinTime = Convert.ToDateTime(strDtBeginDateTime + " " + Convert.ToDateTime(dt.Rows[i]["dtStartTime"].ToString()).ToShortTimeString()).ToString();
                        }
                        else
                        {
                            TPRModel.dtChuQinTime = "";
                        }



                        string comDtStartTime = dt.Rows[i]["dtStartTime"].ToString();
                        string Ndate          = Convert.ToDateTime(strDtBeginDateTime).AddDays(0).ToString("yyyy-MM-dd");
                        string Ydate          = Convert.ToDateTime(strDtBeginDateTime).AddDays(-1).ToString("yyyy-MM-dd");
                        string Tdate          = Convert.ToDateTime(strDtBeginDateTime).AddDays(1).ToString("yyyy-MM-dd");



                        //侯班时间
                        if (dt.Rows[i]["dtArriveTime"].ToString() != "")
                        {
                            string comDtArriveTime = dt.Rows[i]["dtArriveTime"].ToString();
                            if (Convert.ToDateTime(Convert.ToDateTime(comDtArriveTime).ToString("HH:mm")) > Convert.ToDateTime(Convert.ToDateTime(comDtStartTime).ToString("HH:mm")))
                            {
                                TPRModel.dtArriveTime = Convert.ToDateTime(Ydate + " " + Convert.ToDateTime(dt.Rows[i]["dtArriveTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                            else
                            {
                                TPRModel.dtArriveTime = Convert.ToDateTime(Ndate + " " + Convert.ToDateTime(dt.Rows[i]["dtArriveTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                        }

                        else
                        {
                            TPRModel.dtArriveTime = "";
                        }


                        //叫班时间
                        if (dt.Rows[i]["dtCallTime"].ToString() != "")
                        {
                            string comDtCallTime = dt.Rows[i]["dtCallTime"].ToString();

                            if (Convert.ToDateTime(Convert.ToDateTime(comDtCallTime).ToString("HH:mm")) > Convert.ToDateTime(Convert.ToDateTime(comDtStartTime).ToString("HH:mm")))
                            {
                                TPRModel.dtCallTime = Convert.ToDateTime(Ydate + " " + Convert.ToDateTime(dt.Rows[i]["dtCallTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                            else
                            {
                                TPRModel.dtCallTime = Convert.ToDateTime(Ndate + " " + Convert.ToDateTime(dt.Rows[i]["dtCallTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                        }

                        else
                        {
                            TPRModel.dtCallTime = "";
                        }


                        TPRModel.dtStartTrainTime = "";
                        //开车时间
                        if (dt.Rows[i]["dtPlanStartTime"].ToString() != "")
                        {
                            string comDtStartTrainTime = dt.Rows[i]["dtPlanStartTime"].ToString();
                            if (Convert.ToDateTime(Convert.ToDateTime(comDtStartTrainTime).ToString("HH:mm")) >= Convert.ToDateTime(Convert.ToDateTime(comDtStartTime).ToString("HH:mm")))
                            {
                                TPRModel.dtStartTrainTime = Convert.ToDateTime(Ndate + " " + Convert.ToDateTime(dt.Rows[i]["dtPlanStartTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                            else
                            {
                                TPRModel.dtStartTrainTime = Convert.ToDateTime(Tdate + " " + Convert.ToDateTime(dt.Rows[i]["dtPlanStartTime"].ToString()).ToString("HH:mm")).ToString();
                            }
                        }



                        TPRModel.strTrainNo         = dt.Rows[i]["strTrainNo"].ToString();
                        TPRModel.strGUID            = System.Guid.NewGuid().ToString();
                        TPRModel.strTrainJiaoLuGUID = dt.Rows[i]["strTrainJiaoLuGUID"].ToString();
                        TPRModel.nNeedRest          = 0;
                        if (dt.Rows[i]["nNeedRest"].ToString() != "")
                        {
                            TPRModel.nNeedRest = int.Parse(dt.Rows[i]["nNeedRest"].ToString());
                        }
                        dal.AddPlan(TPRModel);
                    }
                }
            }



            DataSet   set   = dal.GetPlanRest(DtBeginDate, DtEndDate, strJiaoluGUID);
            DataTable table = set.Tables[0];
            DataView  view  = table.DefaultView;

            table = view.ToTable();
            return(DataTableToList(table));
        }
예제 #17
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateAndFirst(Modal_Plan_Rest model, string jiaoluID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TAB_Plan_Sign set ");
            strSql.Append("strTrainJiaoLuGUID=@strTrainJiaoLuGUID,");
            strSql.Append("dtArriveTime=@dtArriveTime,");
            strSql.Append("dtCallTime=@dtCallTime,");
            strSql.Append("strTrainNo=@strTrainNo,");
            strSql.Append("dtChuQinTime=@dtChuQinTime,");
            strSql.Append("dtStartTrainTime=@dtStartTrainTime,");
            strSql.Append("strTrainNoGUID=@strTrainNoGUID,");
            strSql.Append("strWorkGrouGUID=@strWorkGrouGUID,");
            strSql.Append("strTrainmanGUID1=@strTrainmanGUID1,");
            strSql.Append("strTrainmanGUID2=@strTrainmanGUID2,");
            strSql.Append("strTrainmanGUID3=@strTrainmanGUID3,");
            strSql.Append("strTrainmanGUID4=@strTrainmanGUID4");
            strSql.Append(" where strGUID=@strGUID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strTrainJiaoLuGUID", SqlDbType.VarChar,   50),
                new SqlParameter("@dtArriveTime",       SqlDbType.DateTime),
                new SqlParameter("@dtCallTime",         SqlDbType.DateTime),
                new SqlParameter("@strTrainNo",         SqlDbType.VarChar,   50),
                new SqlParameter("@dtChuQinTime",       SqlDbType.DateTime),
                new SqlParameter("@dtStartTrainTime",   SqlDbType.DateTime),
                new SqlParameter("@strTrainNoGUID",     SqlDbType.VarChar,   50),
                new SqlParameter("@strWorkGrouGUID",    SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID1",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID2",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID3",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID4",   SqlDbType.VarChar,   50),
                new SqlParameter("@strGUID",            SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.strTrainJiaoLuGUID;
            parameters[1].Value  = model.dtArriveTime;
            parameters[2].Value  = model.dtCallTime;
            parameters[3].Value  = model.strTrainNo;
            parameters[4].Value  = model.dtChuQinTime;
            parameters[5].Value  = model.dtStartTrainTime;
            parameters[6].Value  = model.strTrainNoGUID;
            parameters[7].Value  = model.strWorkGrouGUID;
            parameters[8].Value  = model.strTrainmanGUID1;
            parameters[9].Value  = model.strTrainmanGUID2;
            parameters[10].Value = model.strTrainmanGUID3;
            parameters[11].Value = model.strTrainmanGUID4;
            parameters[12].Value = model.strGUID;
            int rows1 = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);

            string strSql2 = "update TAB_Plan_SignJiaoLuIndex set strTrainJiaoLuGUID=" + jiaoluID + " where nID=1";
            int    rows2   = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql2.ToString());

            if (rows1 + rows2 > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #18
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Modal_Plan_Rest model)
        {
            if (string.IsNullOrEmpty(model.strWorkGrouGUID))
            {
                throw new Exception("找不到人员所属机组,或者人员处于请假状态,不能签点!");
            }


            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TAB_Plan_Sign set ");
            strSql.Append("strTrainJiaoLuGUID=@strTrainJiaoLuGUID,");
            strSql.Append("dtArriveTime=@dtArriveTime,");
            strSql.Append("dtCallTime=@dtCallTime,");
            strSql.Append("strTrainNo=@strTrainNo,");
            strSql.Append("dtChuQinTime=@dtChuQinTime,");
            strSql.Append("strTrainNoGUID=@strTrainNoGUID,");
            strSql.Append("strWorkGrouGUID=@strWorkGrouGUID,");
            strSql.Append("strTrainmanGUID1=@strTrainmanGUID1,");
            strSql.Append("strTrainmanGUID2=@strTrainmanGUID2,");
            strSql.Append("strTrainmanGUID3=@strTrainmanGUID3,");
            strSql.Append("strTrainmanGUID4=@strTrainmanGUID4,");
            strSql.Append("ePlanState=@ePlanState,");
            strSql.Append("nNeedRest=@nNeedRest,");
            strSql.Append("nFinished=@nFinished,");
            strSql.Append("dtSignTime=@dtSignTime,");
            strSql.Append("dtStartTrainTime=@dtStartTrainTime");
            strSql.Append(" where strGUID=@strGUID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strTrainJiaoLuGUID", SqlDbType.VarChar,   50),
                new SqlParameter("@dtArriveTime",       SqlDbType.DateTime),
                new SqlParameter("@dtCallTime",         SqlDbType.DateTime),
                new SqlParameter("@strTrainNo",         SqlDbType.VarChar,   50),
                new SqlParameter("@dtChuQinTime",       SqlDbType.DateTime),
                new SqlParameter("@strTrainNoGUID",     SqlDbType.VarChar,   50),
                new SqlParameter("@strWorkGrouGUID",    SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID1",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID2",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID3",   SqlDbType.VarChar,   50),
                new SqlParameter("@strTrainmanGUID4",   SqlDbType.VarChar,   50),
                new SqlParameter("@ePlanState",         SqlDbType.VarChar,   50),
                new SqlParameter("@nNeedRest",          SqlDbType.Int,        4),
                new SqlParameter("@nFinished",          SqlDbType.Int,        4),
                new SqlParameter("@dtSignTime",         SqlDbType.VarChar,   50),
                new SqlParameter("@dtStartTrainTime",   SqlDbType.VarChar,   50),
                new SqlParameter("@strGUID",            SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.strTrainJiaoLuGUID;
            parameters[1].Value  = model.dtArriveTime;
            parameters[2].Value  = model.dtCallTime;
            parameters[3].Value  = model.strTrainNo;
            parameters[4].Value  = model.dtChuQinTime;
            parameters[5].Value  = model.strTrainNoGUID;
            parameters[6].Value  = model.strWorkGrouGUID;
            parameters[7].Value  = model.strTrainmanGUID1;
            parameters[8].Value  = model.strTrainmanGUID2;
            parameters[9].Value  = model.strTrainmanGUID3;
            parameters[10].Value = model.strTrainmanGUID4;
            parameters[11].Value = model.ePlanState;
            parameters[12].Value = model.nNeedRest;
            parameters[13].Value = model.nFinished;
            parameters[14].Value = model.dtSignTime;
            parameters[15].Value = model.dtStartTrainTime;
            parameters[16].Value = model.strGUID;
            int rows = (int)SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #19
0
        public void SetModelValue(TF.RunSafty.Model.InterfaceModel.PlanRestModels PlanRestModel, Modal_Plan_Rest Plan_Rest)
        {
            string dt = DateTime.Now.ToString();

            if (PlanRestModel.dtarrivetime.ToString() != "")
            {
                Plan_Rest.dtArriveTime = PlanRestModel.dtarrivetime.ToString();
            }
            else
            {
                Plan_Rest.dtArriveTime = dt;
            }
            if (PlanRestModel.dtcalltime.ToString() != "")
            {
                Plan_Rest.dtCallTime = PlanRestModel.dtcalltime.ToString();
            }
            else
            {
                Plan_Rest.dtCallTime = dt;
            }

            if (PlanRestModel.dtchuqintime.ToString() != "")
            {
                Plan_Rest.dtChuQinTime = PlanRestModel.dtchuqintime.ToString();
            }
            else
            {
                Plan_Rest.dtChuQinTime = dt;
            }

            if (PlanRestModel.dtStartTrainTime.ToString() != "")
            {
                Plan_Rest.dtStartTrainTime = PlanRestModel.dtStartTrainTime.ToString();
            }
            else
            {
                Plan_Rest.dtStartTrainTime = dt;
            }

            if (PlanRestModel.dtSignTime.ToString() != "")
            {
                Plan_Rest.dtSignTime = PlanRestModel.dtSignTime.ToString();
            }
            else
            {
                Plan_Rest.dtSignTime = dt;
            }



            Plan_Rest.strGUID            = PlanRestModel.strguid;
            Plan_Rest.strTrainJiaoLuGUID = PlanRestModel.strtrainjiaoluguid;
            Plan_Rest.strTrainmanGUID1   = PlanRestModel.strtrainmanguid1;
            Plan_Rest.strTrainmanGUID2   = PlanRestModel.strtrainmanguid2;
            Plan_Rest.strTrainmanGUID3   = PlanRestModel.strtrainmanguid3;
            Plan_Rest.strTrainmanGUID4   = PlanRestModel.strtrainmanguid4;
            Plan_Rest.strTrainNo         = PlanRestModel.strtrainno;
            Plan_Rest.strTrainNoGUID     = PlanRestModel.strtrainnoguid;
            Plan_Rest.strWorkGrouGUID    = PlanRestModel.strworkgrouguid;
            Plan_Rest.nNeedRest          = PlanRestModel.nNeedRest;
            Plan_Rest.nFinished          = PlanRestModel.nFinished;;
            if (PlanRestModel.ePlanState != "")
            {
                Plan_Rest.ePlanState = int.Parse(PlanRestModel.ePlanState);
            }
            else
            {
                Plan_Rest.ePlanState = 0;
            }
        }
예제 #20
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Modal_Plan_Rest model)
 {
     model.strGUID = System.Guid.NewGuid().ToString();
     return(dal.AddPlan(model));
 }