コード例 #1
0

        
コード例 #2
0

        
コード例 #3
0

        
コード例 #4
0
        /// <summary> 车型信息同步
        /// </summary>
        /// <returns>返回同步车型条数,如为-1,同步失败</returns>
        public static int LoadBusModel()
        {
            ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
            QueryBusModel.clientInfo clientInfo = new QueryBusModel.clientInfo();
            clientInfo.clientID  = GlobalStaticObj_Servier.Instance.ClientID;
            clientInfo.serviceID = "busModelQuery";
            QueryBusModel.busModelQueryService serv = new QueryBusModel.busModelQueryService();
            QueryBusModel.Result result             = serv.busModelQuery(GlobalStaticObj_Servier.Instance.ClientID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "QUERY", clientInfo);
            if (result.state == "F")
            {
                return(-1);
            }
            QueryBusModel.busModel[] busModelArr = result.Details;
            if (busModelArr.Length == 0)
            {
                return(0);
            }

            string nowTicks          = Common.LocalDateTimeToUtcLong(DateTime.Now).ToString();
            List <SysSQLString> list = new List <SysSQLString>();

            foreach (QueryBusModel.busModel item in busModelArr)
            {
                SysSQLString sysSQLString = new SysSQLString();
                sysSQLString.cmdType = CommandType.Text;
                sysSQLString.Param   = new Dictionary <string, string>();
                StringBuilder strSql         = new StringBuilder();
                bool          isContactExist = DBHelper.IsExist("判断车型信息是否存在", "tb_vehicle_models", "vm_code='" + item.vm_code + "'");
                if (isContactExist)
                {
                    #region 更新语句
                    strSql.Append(" update tb_vehicle_models set ");
                    strSql.Append(" out_price = @out_price , ");
                    strSql.Append(" out_special_price = @out_special_price , ");
                    strSql.Append(" data_sources = @data_sources , ");
                    strSql.Append(" vm_class = @vm_class , ");
                    strSql.Append(" v_sale_type = @v_sale_type , ");
                    strSql.Append(" report_price = @report_price , ");
                    strSql.Append(" repair_price = @repair_price , ");
                    strSql.Append(" begin_date = @begin_date , ");
                    strSql.Append(" end_date = @end_date , ");
                    strSql.Append(" status = @status , ");
                    strSql.Append(" update_by = @update_by , ");
                    strSql.Append(" update_time = @update_time ");
                    strSql.Append(" where vm_code=@vm_code;  ");
                    #endregion
                }
                else
                {
                    #region 插入语句
                    strSql.Append(" insert into tb_vehicle_models(");
                    strSql.Append("vm_id,vm_code,out_price,out_special_price,data_sources,vm_class,v_sale_type,report_price,repair_price,begin_date,end_date,status,enable_flag,create_by,create_time,update_by,update_time");
                    strSql.Append(") values (");
                    strSql.Append("@vm_id,@vm_code,@out_price,@out_special_price,@data_sources,@vm_class,@v_sale_type,@report_price,@repair_price,@begin_date,@end_date,@status,@enable_flag,@create_by,@create_time,@update_by,@update_time");
                    strSql.Append("); ");
                    #endregion
                    sysSQLString.Param.Add("vm_id", Guid.NewGuid().ToString());
                    sysSQLString.Param.Add("create_by", GlobalStaticObj_Servier.Instance.UserID);
                    sysSQLString.Param.Add("create_time", nowTicks);
                }
                #region
                sysSQLString.sqlString = strSql.ToString();
                sysSQLString.Param.Add("vm_code", item.vm_code);
                sysSQLString.Param.Add("out_price", item.out_price);
                sysSQLString.Param.Add("out_special_price", item.out_special_price);
                sysSQLString.Param.Add("vm_class", item.vm_type);
                sysSQLString.Param.Add("v_sale_type", item.v_sale_type);
                sysSQLString.Param.Add("report_price", item.report_price);
                sysSQLString.Param.Add("repair_price", item.repair_price);
                sysSQLString.Param.Add("begin_date", item.begin_date);
                sysSQLString.Param.Add("end_date", item.end_date);
                sysSQLString.Param.Add("status", item.status.ToString());
                sysSQLString.Param.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString());
                sysSQLString.Param.Add("data_sources", ((int)DataSources.EnumDataSources.YUTONG).ToString());
                sysSQLString.Param.Add("update_by", GlobalStaticObj_Servier.Instance.UserID);
                sysSQLString.Param.Add("update_time", nowTicks);
                #endregion
                list.Add(sysSQLString);
            }
            bool flag = DBHelper.BatchExeSQLStringMultiByTrans("宇通:同步车型", list);
            if (!flag)
            {
                return(-1);
            }
            return(busModelArr.Length);
        }