Exemplo n.º 1
0
        public DB_SysConfig_Out GetDBSysConfig(string input)
        {
            DB_SysConfig_Out json  = new DB_SysConfig_Out();
            DB_SysConfig_In  model = null;

            try
            {
                model = JsonConvert.DeserializeObject <DB_SysConfig_In>(input);
                string         strSql        = " select * from TAB_System_Config where strSection =@strSection and strIdent =@strIdent ";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strSection", model.SectionName), new SqlParameter("strIdent", model.Ident),
                };
                DataTable table =
                    SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters).Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    json.data.strValue = table.Rows[0]["strValue"].ToString();
                    json.result        = "0";
                    json.resultStr     = "获取配置成功";
                }
                else
                {
                    json.data.strValue = String.Empty;
                    json.result        = "1";
                    json.resultStr     = "获取配置失败";
                }
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Exemplo n.º 2
0
        public SiteConfig_Out GetSiteConfig(string input)
        {
            SiteConfig_Out json  = new SiteConfig_Out();
            SiteConfig_In  model = null;

            try
            {
                model = JsonConvert.DeserializeObject <SiteConfig_In>(input);
                string         strSql        = "select * from TAB_System_SiteConfig where strSiteNumber=@strSiteNumber ";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strSiteNumber", model.SiteNumber),
                };
                DataTable table =
                    SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters).Tables[0];
                json.data = new List <SiteConfig>();
                SiteConfig config = null;
                foreach (DataRow dataRow in table.Rows)
                {
                    config          = new SiteConfig();
                    config.strName  = dataRow["strName"].ToString();
                    config.strValue = dataRow["strValue"].ToString();
                    json.data.Add(config);
                }
                json.result    = "0";
                json.resultStr = "获取客户端配置成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Exemplo n.º 3
0
        public IsJiaoLuInSite_Out IsJiaoLuInSite(string input)
        {
            IsJiaoLuInSite_Out json = new IsJiaoLuInSite_Out();

            json.data = new IsJiaoLuInSiteResult();
            IsJiaoLuInSite_In model  = null;
            string            strSql = String.Empty;
            DataTable         table  = null;

            try
            {
                model  = JsonConvert.DeserializeObject <IsJiaoLuInSite_In>(input);
                strSql = @"select strTrainJiaoluGUID  from TAB_Base_TrainJiaoluInSite where strSiteGUID =@strSiteGUID
               and strTrainJiaoluGUID = @strTrainJiaoluGUID
               union  
               select strSubTrainJiaoLuGUID from TAB_Base_TrainJiaolu_SubDetail where strTrainJiaoluGUID in  
               (select strTrainJiaoluGUID  from TAB_Base_TrainJiaoluInSite where strSiteGUID =@strSiteGUID ) 
                 and strSubTrainJiaoLuGUID =@strTrainJiaoluGUID ";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strSiteGUID", model.SiteGUID), new SqlParameter("strTrainJiaoluGUID", model.TrainJiaoluGUID),
                };
                table =
                    SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters).Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    json.data.isInSite = 1;
                    json.result        = "0";
                    json.resultStr     = "判断交路是否在客户端的管理范围成功";
                }
                else
                {
                    json.data.isInSite = 0;
                }
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                json.result    = "1";
                json.resultStr = "判断交路是否在客户端的管理范围失败";
                throw ex;
            }
            return(json);
        }
Exemplo n.º 4
0
        public TrainJiaolu_Out GetTrainJiaolu(string input)
        {
            TrainJiaolu_Out json   = new TrainJiaolu_Out();
            TrainJiaolu_In  model  = null;
            RRsTrainJiaolu  jiaolu = null;

            try
            {
                model = JsonConvert.DeserializeObject <TrainJiaolu_In>(input);
                string         strSql        = "select * from VIEW_Base_TrainJiaolu where  strTrainJiaoluGUID=@strTrainJiaoluGUID ";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strTrainJiaoluGUID", model.strTrainJiaoluGUID),
                };
                DataTable table =
                    SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters).Tables[0];
                json.data = new List <RRsTrainJiaolu>();
                foreach (DataRow dataRow in table.Rows)
                {
                    jiaolu = new RRsTrainJiaolu();
                    jiaolu.strEndStation       = dataRow["strEndStation"].ToString();
                    jiaolu.strEndStationName   = dataRow["strEndStationName"].ToString();
                    jiaolu.strStartStation     = dataRow["strStartStation"].ToString();
                    jiaolu.strStartStationName = dataRow["strStartStationName"].ToString();
                    jiaolu.strTrainJiaoluGUID  = dataRow["strTrainJiaoluGUID"].ToString();
                    jiaolu.strTrainJiaoluName  = dataRow["strTrainJiaoluName"].ToString();
                    jiaolu.strWorkShopGUID     = dataRow["strWorkShopGUID"].ToString();
                    jiaolu.bIsBeginWorkFP      = Convert.ToInt32(dataRow["bIsBeginWorkFP"].ToString());
                    json.data.Add(jiaolu);
                }
                json.result    = "0";
                json.resultStr = "获取交路成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Exemplo n.º 5
0
        public SetConfig_Out SetDBSysConfig(string input)
        {
            SetConfig_Out json   = new SetConfig_Out();
            SetConfig_In  model  = null;
            string        strSql = String.Empty;
            int           count  = -1;

            try
            {
                model  = JsonConvert.DeserializeObject <SetConfig_In>(input);
                strSql = "select count(*) from TAB_System_Config where strSection = @strSection and strIdent =@strIdent ";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strSection", model.SectionName), new SqlParameter("strIdent", model.Ident),
                    new SqlParameter("strValue", model.Value),
                };
                count =
                    Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql,
                                                            sqlParameters));
                if (count == 0)
                {
                    strSql =
                        "insert into TAB_System_Config(strSection,strIdent,strValue) values(@strSection,@strIdent,@strValue)";
                }
                else
                {
                    strSql =
                        "update TAB_System_Config set strValue=@strValue where strSection = @strSection and strIdent =@strIdent ";
                }
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters);
                json.result    = "0";
                json.resultStr = "设置数据库配置成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Exemplo n.º 6
0
        public GetStation_Out GetStationsOfJiaoJu(string input)
        {
            GetStation_Out json = new GetStation_Out();

            json.data = new List <Station>();
            GetStation_In model   = null;
            Station       station = null;
            string        strSql  = String.Empty;

            try
            {
                model  = JsonConvert.DeserializeObject <GetStation_In>(input);
                strSql = @"select B.strStationGUID,B.strStationNumber,B.strStationName from  
     TAB_Base_StationInTrainJiaolu AS A   inner join TAB_Base_Station AS B 
ON B.strStationGUID = A.strStationGUID  where A.strTrainJiaoluGUID = @strTrainJiaoluGUID order by nSortid";
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strTrainJiaoluGUID", model.strJiaoLuID),
                };
                DataTable table =
                    SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters).Tables[0];
                foreach (DataRow row in table.Rows)
                {
                    station = new Station();
                    station.strStationGUID   = row["strStationGUID"].ToString();
                    station.strStationName   = row["strStationName"].ToString();
                    station.strStationNumber = row["strStationNumber"].ToString();
                    json.data.Add(station);
                }
                json.result    = "0";
                json.resultStr = "获取车站成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Exemplo n.º 7
0
        public CheCi_Out GetKehuoByCheCi(string input)
        {
            CheCi_Out json  = new CheCi_Out();
            CheCi_In  model = null;

            //List<TrainNoBelong> trainNoBelongs = null;
            //string strReg = String.Empty;
            //Regex regex = null;
            //int nBeginNumber, nEndNumber;
            //bool isMatch = false;
            try
            {
                #region 原来的代码
                //model = JsonConvert.DeserializeObject<CheCi_In>(input);
                //trainNoBelongs = GetTrainNoBelongArray();
                //if (trainNoBelongs != null)
                //{
                //    foreach (var trainNoBelong in trainNoBelongs)
                //    {
                //        nBeginNumber = trainNoBelong.nBeginNumber;
                //        nEndNumber = trainNoBelong.nEndNumber;
                //        int CheCi;
                //        json.result = "0";
                //        json.resultStr = "获取车次成功";
                //        //构造正则表达式
                //        if (String.IsNullOrEmpty(trainNoBelong.strTrainNoHead))
                //        {
                //            if (Int32.TryParse(model.TrainNo, out CheCi) && CheCi >= nBeginNumber && CheCi <= nEndNumber)
                //            {
                //                json.data.Kehuo = trainNoBelong.strKehuoName;
                //                isMatch = true;
                //                break;
                //            }
                //        }
                //        else
                //        {
                //            strReg = String.Format("^{0}", trainNoBelong.strTrainNoHead);
                //        }
                //        regex = new Regex(strReg);
                //        Match match = regex.Match(model.TrainNo);
                //        string strNum = String.Empty;
                //        if (match.Success)
                //        {
                //            int num;
                //            strNum = model.TrainNo.Substring(match.Length, model.TrainNo.Length - match.Length);
                //            if (strNum.Length > 0)
                //            {
                //                if ((Int32.TryParse(strNum, out num) && num >= nBeginNumber && num <= nEndNumber))
                //                {
                //                    json.data.Kehuo = trainNoBelong.strKehuoName;
                //                    isMatch = true;
                //                    break;
                //                }
                //            }
                //            else
                //            {
                //                if (trainNoBelong.nBeginNumber == 0 && trainNoBelong.nEndNumber == 0)
                //                {
                //                    json.data.Kehuo = trainNoBelong.strKehuoName;
                //                    isMatch = true;
                //                    break;
                //                }
                //            }

                //        }

                //    }
                //}
                //if (!isMatch)
                //{
                //    //json.result = "1";
                //    //json.resultStr = "根据车次获取客货类型失败,没有找到匹配的规则";
                //    json.data.Kehuo = "";
                //}
                #endregion
                string Remarks = "";
                model             = JsonConvert.DeserializeObject <CheCi_In>(input);
                json.data.Kehuo   = getKeHuoByTrainNo(model.TrainNo, ref Remarks);
                json.data.Remarks = Remarks;
                json.result       = "0";
                json.resultStr    = "获取客货成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }