public static void AddRefundAndReschedulingNewDetail(RefundAndReschedulingDetail detail, string account) { var repository = ChinaPay.B3B.Service.Foundation.Repository.Factory.CreateRefundAndReschedulingNewRepository(); repository.Insert(detail); saveLog(OperationType.Insert, "添加退改签客规详细信息", detail.Id.ToString(), account); }
public IEnumerable <RefundAndReschedulingDetail> Query(string airline) { var result = new List <RefundAndReschedulingDetail>(); string sql = @"SELECT [Id],[Bunks],[ScrapBefore],[ScrapAfter],[ChangeBefore],[ChangeAfter],[Endorse] FROM [dbo].[T_RefundAndReschedulingDetail] WHERE Airline=@Airline"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("@Airline", airline); using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { var item = new RefundAndReschedulingDetail(reader.GetGuid(0)); item.Bunks = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); item.ScrapBefore = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); item.ScrapAfter = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); item.ChangeBefore = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); item.ChangeAfter = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); item.Endorse = reader.IsDBNull(6) ? string.Empty : reader.GetString(6); item.Airline = airline; result.Add(item); } } } return(result); }
public RefundAndReschedulingDetail Query(Guid detailId) { RefundAndReschedulingDetail result = null; string sql = @"SELECT [Bunks],[ScrapBefore],[ScrapAfter],[ChangeBefore],[ChangeAfter],[Endorse],[Airline] FROM [dbo].[T_RefundAndReschedulingDetail] WHERE [Id]=@Id"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("@Id", detailId); using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { result = new RefundAndReschedulingDetail(detailId); result.Bunks = reader.IsDBNull(0) ? string.Empty : reader.GetString(0); result.ScrapBefore = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); result.ScrapAfter = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); result.ChangeBefore = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); result.ChangeAfter = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); result.Endorse = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); result.Airline = reader.GetString(6); } } } return(result); }
public int Update(RefundAndReschedulingDetail item) { string sql = @"UPDATE [dbo].[T_RefundAndReschedulingDetail] SET [Bunks] = @Bunks,[ScrapBefore] = @ScrapBefore,[ScrapAfter] = @ScrapAfter ,[ChangeBefore] = @ChangeBefore,[ChangeAfter] = @ChangeAfter,[Endorse] = @Endorse,[Airline]=@Airline WHERE [Id] = @Id"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("@Id", item.Id); dbOperator.AddParameter("@Airline", item.Airline); if (string.IsNullOrWhiteSpace(item.Bunks)) { dbOperator.AddParameter("@Bunks", DBNull.Value); } else { dbOperator.AddParameter("@Bunks", item.Bunks); } if (string.IsNullOrWhiteSpace(item.ScrapBefore)) { dbOperator.AddParameter("@ScrapBefore", DBNull.Value); } else { dbOperator.AddParameter("@ScrapBefore", item.ScrapBefore); } if (string.IsNullOrWhiteSpace(item.ScrapAfter)) { dbOperator.AddParameter("@ScrapAfter", DBNull.Value); } else { dbOperator.AddParameter("@ScrapAfter", item.ScrapAfter); } if (string.IsNullOrWhiteSpace(item.ChangeBefore)) { dbOperator.AddParameter("@ChangeBefore", DBNull.Value); } else { dbOperator.AddParameter("@ChangeBefore", item.ChangeBefore); } if (string.IsNullOrWhiteSpace(item.ChangeAfter)) { dbOperator.AddParameter("@ChangeAfter", DBNull.Value); } else { dbOperator.AddParameter("@ChangeAfter", item.ChangeAfter); } if (string.IsNullOrWhiteSpace(item.Endorse)) { dbOperator.AddParameter("@Endorse", DBNull.Value); } else { dbOperator.AddParameter("@Endorse", item.Endorse); } return(dbOperator.ExecuteNonQuery(sql)); } }
protected void btnSave_Click(object sender, EventArgs e) { if (Request.QueryString["action"] != null) { if (Request.QueryString["action"].ToString() == "add") { RefundAndReschedulingDetail detail = new RefundAndReschedulingDetail() { Bunks = this.txtBunks.Text.Trim(), Endorse = this.txtEndorse.InnerText.Trim() }; if (this.hfdScrap.Value == "split") { detail.ScrapBefore = this.txtScrapBefore.InnerText.Trim(); detail.ScrapAfter = this.txtScrapAfter.InnerText.Trim(); } else { detail.ScrapBefore = detail.ScrapAfter = this.txtScrap.InnerText.Trim(); } if (this.hfdChange.Value == "split") { detail.ChangeBefore = this.txtChangeBefore.InnerText.Trim(); detail.ChangeAfter = this.txtChangeAfter.InnerText.Trim(); } else { detail.ChangeBefore = detail.ChangeAfter = this.txtChange.InnerText.Trim(); } detail.Airline = Request.QueryString["airline"]; try { FoundationService.AddRefundAndReschedulingNewDetail(detail, CurrentUser.UserName); RegisterScript("alert('添加成功!'); window.location.href='RefundChangeRuleDetail.aspx?Code=" + Request.QueryString["airline"] + "'"); } catch (Exception ex) { ShowExceptionMessage(ex, "添加"); } } else { RefundAndReschedulingDetail detail = new RefundAndReschedulingDetail(Guid.Parse(Request.QueryString["Id"])) { Bunks = this.txtBunks.Text.Trim(), Endorse = this.txtEndorse.InnerText.Trim() }; if (this.hfdScrap.Value == "split") { detail.ScrapBefore = this.txtScrapBefore.InnerText.Trim(); detail.ScrapAfter = this.txtScrapAfter.InnerText.Trim(); } else { detail.ScrapBefore = detail.ScrapAfter = this.txtScrap.InnerText.Trim(); } if (this.hfdChange.Value == "split") { detail.ChangeBefore = this.txtChangeBefore.InnerText.Trim(); detail.ChangeAfter = this.txtChangeAfter.InnerText.Trim(); } else { detail.ChangeBefore = detail.ChangeAfter = this.txtChange.InnerText.Trim(); } detail.Airline = Request.QueryString["airline"]; try { FoundationService.UpdateRefundAndReschedulingNewDetail(detail, CurrentUser.UserName); RegisterScript("alert('修改成功!'); window.location.href='RefundChangeRuleDetail.aspx?Code=" + Request.QueryString["airline"] + "'"); } catch (Exception ex) { ShowExceptionMessage(ex, "修改"); } } } }
public int Insert(RefundAndReschedulingDetail item) { string sql = @"INSERT INTO [B3B].[dbo].[T_RefundAndReschedulingDetail] ([Id],[Bunks],[ScrapBefore],[ScrapAfter],[ChangeBefore],[ChangeAfter],[Endorse],[Airline]) VALUES (@Id,@Bunks,@ScrapBefore,@ScrapAfter,@ChangeBefore,@ChangeAfter,@Endorse,@Airline)"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("@Id", item.Id); dbOperator.AddParameter("@Airline", item.Airline); if (string.IsNullOrWhiteSpace(item.Bunks)) { dbOperator.AddParameter("@Bunks", DBNull.Value); } else { dbOperator.AddParameter("@Bunks", item.Bunks); } if (string.IsNullOrWhiteSpace(item.ScrapBefore)) { dbOperator.AddParameter("@ScrapBefore", DBNull.Value); } else { dbOperator.AddParameter("@ScrapBefore", item.ScrapBefore); } if (string.IsNullOrWhiteSpace(item.ScrapAfter)) { dbOperator.AddParameter("@ScrapAfter", DBNull.Value); } else { dbOperator.AddParameter("@ScrapAfter", item.ScrapAfter); } if (string.IsNullOrWhiteSpace(item.ChangeBefore)) { dbOperator.AddParameter("@ChangeBefore", DBNull.Value); } else { dbOperator.AddParameter("@ChangeBefore", item.ChangeBefore); } if (string.IsNullOrWhiteSpace(item.ChangeAfter)) { dbOperator.AddParameter("@ChangeAfter", DBNull.Value); } else { dbOperator.AddParameter("ChangeAfter", item.ChangeAfter); } if (string.IsNullOrWhiteSpace(item.Endorse)) { dbOperator.AddParameter("@Endorse", DBNull.Value); } else { dbOperator.AddParameter("@Endorse", item.Endorse); } return(dbOperator.ExecuteNonQuery(sql)); } }