Beispiel #1
0
 public void addDb(getModifyAndRefundStipulatesReply rep)
 {
     try
     {
         string           seatId         = "0";
         string           lastModifiedAt = "2000-01-01 00:00:00";
         int              i          = 0;
         FlightAirRuleDAL airRuleBll = new FlightAirRuleDAL();
         ShowProcessIngLog(DateTime.Now + ":开始添加退改签规定包:" + rep.modifyAndRefundStipulateList.Length);
         //获取记录并添加到数据库中
         for (i = 0; i < rep.modifyAndRefundStipulateList.Length; i++)
         {
             FlightAirRule airRule = new FlightAirRule();
             airRule.id          = System.Guid.NewGuid().ToString();
             airRule.returnn     = HttpUtility.UrlDecode(rep.modifyAndRefundStipulateList[i].refundStipulate, System.Text.Encoding.UTF8);
             airRule.endorsement = HttpUtility.UrlDecode(rep.modifyAndRefundStipulateList[i].modifyStipulate, System.Text.Encoding.UTF8);
             lastModifiedAt      = rep.modifyAndRefundStipulateList[i].modifiedAt;
             seatId            = rep.modifyAndRefundStipulateList[i].seatId.ToString();
             airRule.seatclass = rep.modifyAndRefundStipulateList[i].seatCode;
             airRule.change    = HttpUtility.UrlDecode(rep.modifyAndRefundStipulateList[i].changeStipulate, System.Text.Encoding.UTF8);
             airRule.airline   = rep.modifyAndRefundStipulateList[i].airlineCode;
             try
             {
                 int r = airRuleBll.Add(airRule);
                 if (r == 0)
                 {
                     ShowProcessIngLog("添加航空公司客规失败:" + rep.modifyAndRefundStipulateList[i].airlineCode + rep.modifyAndRefundStipulateList[i].seatCode + rep.modifyAndRefundStipulateList[i].seatId);
                 }
             }
             catch (Exception ex)
             {
             }
         }
         if (i >= rep.modifyAndRefundStipulateList.Length)
         {
             ShowProcessIngLog(DateTime.Now + ":添加完成:" + rep.modifyAndRefundStipulateList.Length + ",保存最后一次信息:Info=" + lastModifiedAt + "|" + seatId);
             SaveLastUpTimeAndId(lastModifiedAt + "|" + seatId, "AirKGLog");
         }
     }
     catch (Exception ex)
     { }
 }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(FlightAirRule model)
        {
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into FlightAirRule(");
                strSql.Append("id,airline,seatclass,returnn,endorsement,returnndis,isdel,createby,createtime,change)");
                strSql.Append(" values (");
                strSql.Append("@id,@airline,@seatclass,@returnn,@endorsement,@returnndis,@isdel,@createby,@createtime,@change)");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",          SqlDbType.VarChar,   50),
                    new SqlParameter("@airline",     SqlDbType.VarChar,   50),
                    new SqlParameter("@seatclass",   SqlDbType.VarChar,   50),
                    new SqlParameter("@returnn",     SqlDbType.NVarChar),
                    new SqlParameter("@endorsement", SqlDbType.NVarChar),
                    new SqlParameter("@returnndis",  SqlDbType.VarChar,   50),
                    new SqlParameter("@isdel",       SqlDbType.Bit,        1),
                    new SqlParameter("@createby",    SqlDbType.Int,        4),
                    new SqlParameter("@createtime",  SqlDbType.DateTime),
                    new SqlParameter("@change",      SqlDbType.NVarChar)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.airline;
                parameters[2].Value = model.seatclass;
                parameters[3].Value = model.returnn;
                parameters[4].Value = model.endorsement;
                parameters[5].Value = model.returnndis;
                parameters[6].Value = model.isdel;
                parameters[7].Value = model.createby;
                parameters[8].Value = model.createtime;
                parameters[9].Value = model.change;

                int r = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
                return(r);
            }
            catch (Exception ex)
            {
                return(1);
            }
        }