private void ShowInfo() { Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd bll = new Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd(); Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model = bll.GetModel(); this.txtId.Text = model.Id.ToString(); this.txtRcvType.Text = model.RcvType; this.txtRcvUserId.Text = model.RcvUserId.ToString(); this.txtRcvUserName.Text = model.RcvUserName; this.txtRcvPhone.Text = model.RcvPhone; this.txtRcvDateTime.Text = model.RcvDateTime.ToString(); this.txtRcvReason.Text = model.RcvReason; this.txtRcvAddress.Text = model.RcvAddress; this.txtRentSubject.Text = model.RentSubject; this.txtRentUserId.Text = model.RentUserId; this.txtRentUserName.Text = model.RentUserName; this.txtRentPhone.Text = model.RentPhone; this.txtRrcBillId.Text = model.RrcBillId.ToString(); this.txtPlanRtnDateTime.Text = model.PlanRtnDateTime.ToString(); this.txtActualRtnDateTime.Text = model.ActualRtnDateTime.ToString(); this.txtBillStatus.Text = model.BillStatus; this.txtDateTimeCreated.Text = model.DateTimeCreated.ToString(); this.txtUserCreator.Text = model.UserCreator; this.txtDateTimeModified.Text = model.DateTimeModified.ToString(); this.txtUserModified.Text = model.UserModified; this.chkState.Checked = model.State; this.txtOrgId.Text = model.OrgId; }
private void ShowInfo() { Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd bll = new Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd(); Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model = bll.GetModel(); this.lblId.Text = model.Id.ToString(); this.lblRcvType.Text = model.RcvType; this.lblRcvUserId.Text = model.RcvUserId.ToString(); this.lblRcvUserName.Text = model.RcvUserName; this.lblRcvPhone.Text = model.RcvPhone; this.lblRcvDateTime.Text = model.RcvDateTime.ToString(); this.lblRcvReason.Text = model.RcvReason; this.lblRcvAddress.Text = model.RcvAddress; this.lblRentSubject.Text = model.RentSubject; this.lblRentUserId.Text = model.RentUserId; this.lblRentUserName.Text = model.RentUserName; this.lblRentPhone.Text = model.RentPhone; this.lblRrcBillId.Text = model.RrcBillId.ToString(); this.lblPlanRtnDateTime.Text = model.PlanRtnDateTime.ToString(); this.lblActualRtnDateTime.Text = model.ActualRtnDateTime.ToString(); this.lblBillStatus.Text = model.BillStatus; this.lblDateTimeCreated.Text = model.DateTimeCreated.ToString(); this.lblUserCreator.Text = model.UserCreator; this.lblDateTimeModified.Text = model.DateTimeModified.ToString(); this.lblUserModified.Text = model.UserModified; this.lblState.Text = model.State?"是":"否"; this.lblOrgId.Text = model.OrgId; }
/// <summary> /// 得到一个对象实体 /// </summary> public Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,RcvType,RcvUserId,RcvUserName,RcvPhone,RcvDateTime,RcvReason,RcvAddress,RentSubject,RentUserId,RentUserName,RentPhone,RrcBillId,PlanRtnDateTime,ActualRtnDateTime,BillStatus,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId from Inv_Rcv_Bill_Hd "); strSql.Append(" where "); SQLiteParameter[] parameters = { }; Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model = new Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd(); DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Inv_Rcv_Bill_Hd("); strSql.Append("Id,RcvType,RcvUserId,RcvUserName,RcvPhone,RcvDateTime,RcvReason,RcvAddress,RentSubject,RentUserId,RentUserName,RentPhone,RrcBillId,PlanRtnDateTime,ActualRtnDateTime,BillStatus,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId)"); strSql.Append(" values ("); strSql.Append("@Id,@RcvType,@RcvUserId,@RcvUserName,@RcvPhone,@RcvDateTime,@RcvReason,@RcvAddress,@RentSubject,@RentUserId,@RentUserName,@RentPhone,@RrcBillId,@PlanRtnDateTime,@ActualRtnDateTime,@BillStatus,@DateTimeCreated,@UserCreator,@DateTimeModified,@UserModified,@State,@OrgId)"); SQLiteParameter[] parameters = { new SQLiteParameter("@Id", DbType.Int32, 4), new SQLiteParameter("@RcvType", DbType.String, 0), new SQLiteParameter("@RcvUserId", DbType.Int32, 4), new SQLiteParameter("@RcvUserName", DbType.String, 0), new SQLiteParameter("@RcvPhone", DbType.String, 0), new SQLiteParameter("@RcvDateTime", DbType.Date), new SQLiteParameter("@RcvReason", DbType.String, 0), new SQLiteParameter("@RcvAddress", DbType.String, 0), new SQLiteParameter("@RentSubject", DbType.String, 0), new SQLiteParameter("@RentUserId", DbType.String, 0), new SQLiteParameter("@RentUserName", DbType.String, 0), new SQLiteParameter("@RentPhone", DbType.String, 0), new SQLiteParameter("@RrcBillId", DbType.Int32, 4), new SQLiteParameter("@PlanRtnDateTime", DbType.Date), new SQLiteParameter("@ActualRtnDateTime", DbType.Date), new SQLiteParameter("@BillStatus", DbType.String, 0), new SQLiteParameter("@DateTimeCreated", DbType.Date), new SQLiteParameter("@UserCreator", DbType.String, 0), new SQLiteParameter("@DateTimeModified", DbType.Date), new SQLiteParameter("@UserModified", DbType.String, 0), new SQLiteParameter("@State", DbType.bit, 1), new SQLiteParameter("@OrgId", DbType.String, 0) }; parameters[0].Value = model.Id; parameters[1].Value = model.RcvType; parameters[2].Value = model.RcvUserId; parameters[3].Value = model.RcvUserName; parameters[4].Value = model.RcvPhone; parameters[5].Value = model.RcvDateTime; parameters[6].Value = model.RcvReason; parameters[7].Value = model.RcvAddress; parameters[8].Value = model.RentSubject; parameters[9].Value = model.RentUserId; parameters[10].Value = model.RentUserName; parameters[11].Value = model.RentPhone; parameters[12].Value = model.RrcBillId; parameters[13].Value = model.PlanRtnDateTime; parameters[14].Value = model.ActualRtnDateTime; parameters[15].Value = model.BillStatus; parameters[16].Value = model.DateTimeCreated; parameters[17].Value = model.UserCreator; parameters[18].Value = model.DateTimeModified; parameters[19].Value = model.UserModified; parameters[20].Value = model.State; parameters[21].Value = model.OrgId; int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd DataRowToModel(DataRow row) { Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model = new Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["RcvType"] != null) { model.RcvType = row["RcvType"].ToString(); } if (row["RcvUserId"] != null && row["RcvUserId"].ToString() != "") { model.RcvUserId = int.Parse(row["RcvUserId"].ToString()); } if (row["RcvUserName"] != null) { model.RcvUserName = row["RcvUserName"].ToString(); } if (row["RcvPhone"] != null) { model.RcvPhone = row["RcvPhone"].ToString(); } if (row["RcvDateTime"] != null && row["RcvDateTime"].ToString() != "") { model.RcvDateTime = DateTime.Parse(row["RcvDateTime"].ToString()); } if (row["RcvReason"] != null) { model.RcvReason = row["RcvReason"].ToString(); } if (row["RcvAddress"] != null) { model.RcvAddress = row["RcvAddress"].ToString(); } if (row["RentSubject"] != null) { model.RentSubject = row["RentSubject"].ToString(); } if (row["RentUserId"] != null) { model.RentUserId = row["RentUserId"].ToString(); } if (row["RentUserName"] != null) { model.RentUserName = row["RentUserName"].ToString(); } if (row["RentPhone"] != null) { model.RentPhone = row["RentPhone"].ToString(); } if (row["RrcBillId"] != null && row["RrcBillId"].ToString() != "") { model.RrcBillId = int.Parse(row["RrcBillId"].ToString()); } if (row["PlanRtnDateTime"] != null && row["PlanRtnDateTime"].ToString() != "") { model.PlanRtnDateTime = DateTime.Parse(row["PlanRtnDateTime"].ToString()); } if (row["ActualRtnDateTime"] != null && row["ActualRtnDateTime"].ToString() != "") { model.ActualRtnDateTime = DateTime.Parse(row["ActualRtnDateTime"].ToString()); } if (row["BillStatus"] != null) { model.BillStatus = row["BillStatus"].ToString(); } if (row["DateTimeCreated"] != null && row["DateTimeCreated"].ToString() != "") { model.DateTimeCreated = DateTime.Parse(row["DateTimeCreated"].ToString()); } if (row["UserCreator"] != null) { model.UserCreator = row["UserCreator"].ToString(); } if (row["DateTimeModified"] != null && row["DateTimeModified"].ToString() != "") { model.DateTimeModified = DateTime.Parse(row["DateTimeModified"].ToString()); } if (row["UserModified"] != null) { model.UserModified = row["UserModified"].ToString(); } if (row["State"] != null && row["State"].ToString() != "") { if ((row["State"].ToString() == "1") || (row["State"].ToString().ToLower() == "true")) { model.State = true; } else { model.State = false; } } if (row["OrgId"] != null) { model.OrgId = row["OrgId"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Inv_Rcv_Bill_Hd set "); strSql.Append("Id=@Id,"); strSql.Append("RcvType=@RcvType,"); strSql.Append("RcvUserId=@RcvUserId,"); strSql.Append("RcvUserName=@RcvUserName,"); strSql.Append("RcvPhone=@RcvPhone,"); strSql.Append("RcvDateTime=@RcvDateTime,"); strSql.Append("RcvReason=@RcvReason,"); strSql.Append("RcvAddress=@RcvAddress,"); strSql.Append("RentSubject=@RentSubject,"); strSql.Append("RentUserId=@RentUserId,"); strSql.Append("RentUserName=@RentUserName,"); strSql.Append("RentPhone=@RentPhone,"); strSql.Append("RrcBillId=@RrcBillId,"); strSql.Append("PlanRtnDateTime=@PlanRtnDateTime,"); strSql.Append("ActualRtnDateTime=@ActualRtnDateTime,"); strSql.Append("BillStatus=@BillStatus,"); strSql.Append("DateTimeCreated=@DateTimeCreated,"); strSql.Append("UserCreator=@UserCreator,"); strSql.Append("DateTimeModified=@DateTimeModified,"); strSql.Append("UserModified=@UserModified,"); strSql.Append("State=@State,"); strSql.Append("OrgId=@OrgId"); strSql.Append(" where "); SQLiteParameter[] parameters = { new SQLiteParameter("@Id", DbType.Int32, 4), new SQLiteParameter("@RcvType", DbType.String, 0), new SQLiteParameter("@RcvUserId", DbType.Int32, 4), new SQLiteParameter("@RcvUserName", DbType.String, 0), new SQLiteParameter("@RcvPhone", DbType.String, 0), new SQLiteParameter("@RcvDateTime", DbType.Date), new SQLiteParameter("@RcvReason", DbType.String, 0), new SQLiteParameter("@RcvAddress", DbType.String, 0), new SQLiteParameter("@RentSubject", DbType.String, 0), new SQLiteParameter("@RentUserId", DbType.String, 0), new SQLiteParameter("@RentUserName", DbType.String, 0), new SQLiteParameter("@RentPhone", DbType.String, 0), new SQLiteParameter("@RrcBillId", DbType.Int32, 4), new SQLiteParameter("@PlanRtnDateTime", DbType.Date), new SQLiteParameter("@ActualRtnDateTime", DbType.Date), new SQLiteParameter("@BillStatus", DbType.String, 0), new SQLiteParameter("@DateTimeCreated", DbType.Date), new SQLiteParameter("@UserCreator", DbType.String, 0), new SQLiteParameter("@DateTimeModified", DbType.Date), new SQLiteParameter("@UserModified", DbType.String, 0), new SQLiteParameter("@State", DbType.bit, 1), new SQLiteParameter("@OrgId", DbType.String, 0) }; parameters[0].Value = model.Id; parameters[1].Value = model.RcvType; parameters[2].Value = model.RcvUserId; parameters[3].Value = model.RcvUserName; parameters[4].Value = model.RcvPhone; parameters[5].Value = model.RcvDateTime; parameters[6].Value = model.RcvReason; parameters[7].Value = model.RcvAddress; parameters[8].Value = model.RentSubject; parameters[9].Value = model.RentUserId; parameters[10].Value = model.RentUserName; parameters[11].Value = model.RentPhone; parameters[12].Value = model.RrcBillId; parameters[13].Value = model.PlanRtnDateTime; parameters[14].Value = model.ActualRtnDateTime; parameters[15].Value = model.BillStatus; parameters[16].Value = model.DateTimeCreated; parameters[17].Value = model.UserCreator; parameters[18].Value = model.DateTimeModified; parameters[19].Value = model.UserModified; parameters[20].Value = model.State; parameters[21].Value = model.OrgId; int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtId.Text)) { strErr += "Id格式错误!\\n"; } if (this.txtRcvType.Text.Trim().Length == 0) { strErr += "RcvType不能为空!\\n"; } if (!PageValidate.IsNumber(txtRcvUserId.Text)) { strErr += "RcvUserId格式错误!\\n"; } if (this.txtRcvUserName.Text.Trim().Length == 0) { strErr += "RcvUserName不能为空!\\n"; } if (this.txtRcvPhone.Text.Trim().Length == 0) { strErr += "RcvPhone不能为空!\\n"; } if (!PageValidate.IsDateTime(txtRcvDateTime.Text)) { strErr += "RcvDateTime格式错误!\\n"; } if (this.txtRcvReason.Text.Trim().Length == 0) { strErr += "RcvReason不能为空!\\n"; } if (this.txtRcvAddress.Text.Trim().Length == 0) { strErr += "RcvAddress不能为空!\\n"; } if (this.txtRentSubject.Text.Trim().Length == 0) { strErr += "RentSubject不能为空!\\n"; } if (this.txtRentUserId.Text.Trim().Length == 0) { strErr += "RentUserId不能为空!\\n"; } if (this.txtRentUserName.Text.Trim().Length == 0) { strErr += "RentUserName不能为空!\\n"; } if (this.txtRentPhone.Text.Trim().Length == 0) { strErr += "RentPhone不能为空!\\n"; } if (!PageValidate.IsNumber(txtRrcBillId.Text)) { strErr += "RrcBillId格式错误!\\n"; } if (!PageValidate.IsDateTime(txtPlanRtnDateTime.Text)) { strErr += "PlanRtnDateTime格式错误!\\n"; } if (!PageValidate.IsDateTime(txtActualRtnDateTime.Text)) { strErr += "ActualRtnDateTime格式错误!\\n"; } if (this.txtBillStatus.Text.Trim().Length == 0) { strErr += "BillStatus不能为空!\\n"; } if (!PageValidate.IsDateTime(txtDateTimeCreated.Text)) { strErr += "DateTimeCreated格式错误!\\n"; } if (this.txtUserCreator.Text.Trim().Length == 0) { strErr += "UserCreator不能为空!\\n"; } if (!PageValidate.IsDateTime(txtDateTimeModified.Text)) { strErr += "DateTimeModified格式错误!\\n"; } if (this.txtUserModified.Text.Trim().Length == 0) { strErr += "UserModified不能为空!\\n"; } if (this.txtOrgId.Text.Trim().Length == 0) { strErr += "OrgId不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Id = int.Parse(this.txtId.Text); string RcvType = this.txtRcvType.Text; int RcvUserId = int.Parse(this.txtRcvUserId.Text); string RcvUserName = this.txtRcvUserName.Text; string RcvPhone = this.txtRcvPhone.Text; DateTime RcvDateTime = DateTime.Parse(this.txtRcvDateTime.Text); string RcvReason = this.txtRcvReason.Text; string RcvAddress = this.txtRcvAddress.Text; string RentSubject = this.txtRentSubject.Text; string RentUserId = this.txtRentUserId.Text; string RentUserName = this.txtRentUserName.Text; string RentPhone = this.txtRentPhone.Text; int RrcBillId = int.Parse(this.txtRrcBillId.Text); DateTime PlanRtnDateTime = DateTime.Parse(this.txtPlanRtnDateTime.Text); DateTime ActualRtnDateTime = DateTime.Parse(this.txtActualRtnDateTime.Text); string BillStatus = this.txtBillStatus.Text; DateTime DateTimeCreated = DateTime.Parse(this.txtDateTimeCreated.Text); string UserCreator = this.txtUserCreator.Text; DateTime DateTimeModified = DateTime.Parse(this.txtDateTimeModified.Text); string UserModified = this.txtUserModified.Text; bool State = this.chkState.Checked; string OrgId = this.txtOrgId.Text; Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd model = new Bsam.Core.Model.Models.Model.Inv_Rcv_Bill_Hd(); model.Id = Id; model.RcvType = RcvType; model.RcvUserId = RcvUserId; model.RcvUserName = RcvUserName; model.RcvPhone = RcvPhone; model.RcvDateTime = RcvDateTime; model.RcvReason = RcvReason; model.RcvAddress = RcvAddress; model.RentSubject = RentSubject; model.RentUserId = RentUserId; model.RentUserName = RentUserName; model.RentPhone = RentPhone; model.RrcBillId = RrcBillId; model.PlanRtnDateTime = PlanRtnDateTime; model.ActualRtnDateTime = ActualRtnDateTime; model.BillStatus = BillStatus; model.DateTimeCreated = DateTimeCreated; model.UserCreator = UserCreator; model.DateTimeModified = DateTimeModified; model.UserModified = UserModified; model.State = State; model.OrgId = OrgId; Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd bll = new Bsam.Core.Model.Models.BLL.Inv_Rcv_Bill_Hd(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }