/// <summary> /// 获取所有租车类型 /// </summary> /// <returns></returns> public List <BorrowKind> BorrowKindSelect() { string sql = "BORROW_KIND_SELECT"; List <BorrowKind> listBorrowKind = new List <BorrowKind>(); dt = new DataTable(); try { using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, null)) { dt.Load(dr); } BorrowKind borrowKindTemp; for (int i = 0; i < dt.Rows.Count; i++) { borrowKindTemp = new BorrowKind(); borrowKindTemp.BkId = Convert.ToInt32(dt.Rows[i]["BKID"]); borrowKindTemp.BbkName = Convert.ToString(dt.Rows[i]["BBKNAME"]); listBorrowKind.Add(borrowKindTemp); } return(listBorrowKind); } catch (Exception ex) { except.ExceptionInsert("查询租车类型出错:" + ex.Message, "BorrowKindSelect", DateTime.Now); return(null); } }
/// <summary> /// 根据BKID获得租车类型 /// </summary> /// <returns></returns> public BorrowKind BorrowKindSelectById(BorrowKind borrowKind) { string sql = "BORROW_KIND_SELECT_BY_ID"; dt = new DataTable(); try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@BKID", SqlDbType.Int) }; para[0].Value = borrowKind.BkId; using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para)) { dt.Load(dr); } BorrowKind borrowKindInfo = new BorrowKind(); borrowKindInfo.BkId = Convert.ToInt32(dt.Rows[0]["BKId"]); borrowKindInfo.BbkName = Convert.ToString(dt.Rows[0]["BBKName"]); return(borrowKindInfo); } catch (Exception ex) { except.ExceptionInsert("查询租车类型出错:" + ex.Message, "BorrowKindSelectById", DateTime.Now); return(null); } }
private void SelectIndexThread(object id) { this.Invoke(new Action(() => { VipNoBorrow vnBorrowTemp = new VipNoBorrow(); vnBorrowTemp.BbkId = (int)id; vnBorrowTemp = vnBorrowBLL.VipNoBorrowSelectByBBKId(vnBorrowTemp); BorrowKind borrowKind = new BorrowKind(); borrowKind.BkId = vnBorrowTemp.RkrId; txtBorrowKind.Text = borrowKindBLL.BorrowKindSelectById(borrowKind).BbkName; if (vnBorrowTemp.IsNight) { labNightCost.Text = "包夜租车"; } else { labNightCost.Text = ""; } txtVNPhone.Text = vnBorrowTemp.VnPhone; txtVNCard.Text = vnBorrowTemp.VnCard; txtBorrowTime.Text = vnBorrowTemp.BbkTime.ToString(); //txtBBKTime.Text = (DateTime.Now - vnBorrowTemp.BbkTime).ToString().Substring (0,8); txtVNNum.Text = vnBorrowTemp.LeftNum.ToString(); txtMark.Text = vnBorrowTemp.Mark; })); }
private void cmbBorrowTimeSelectedIndexChanged(object id) { this.Invoke(new Action(() => { VipBorrowInfo borrowTemp = new VipBorrowInfo(); borrowTemp.BbkId = (int)id; //borrowTemp = borrowBLL.VipBorrowSelectById(borrowTemp);//NZZ2014-08-03修改为下面一句话 borrowTemp = borrowList.Find(item => item.BbkId == (int)id); BorrowKind borrowKind = new BorrowKind(); borrowKind.BkId = borrowTemp.RkrId; txtKind.Text = borrowKindBLL.BorrowKindSelectById(borrowKind).BbkName; txtBorrowNum.Text = borrowTemp.BbkNumber.ToString(); txtUnReturn.Text = borrowTemp.LeftNum.ToString(); txtBorrowMark.Text = borrowTemp.Mark; if (borrowTemp.IsNight) { labNightCost.ForeColor = Color.Red; labNightCost.Text = "包夜租车"; } else { labNightCost.Text = ""; } })); }
/// <summary> /// 填充租车信息 /// </summary> private void FillVipBorrowMessage() { try { if (borrowList == null || borrowList.Count == 0) { DialogResult result = MessageBox.Show("该用户没有需要还的车辆!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No || result == DialogResult.Yes) { isDispose = true; } this.Close(); return; } cmbBorrowTime.DataSource = borrowList; cmbBorrowTime.DisplayMember = "BBKTIME"; cmbBorrowTime.ValueMember = "BBKID"; first = false; int id = (int)cmbBorrowTime.SelectedValue; VipBorrowInfo borrowTemp = new VipBorrowInfo(); borrowTemp.BbkId = id; borrowTemp = borrowBLL.VipBorrowSelectById(borrowTemp); BorrowKind borrowKind = new BorrowKind(); borrowKind.BkId = borrowTemp.RkrId; txtKind.Text = borrowKindBLL.BorrowKindSelectById(borrowKind).BbkName; txtBorrowNum.Text = borrowTemp.BbkNumber.ToString(); txtUnReturn.Text = borrowTemp.LeftNum.ToString(); txtBorrowT.Text = borrowList[0].Times.ToString(); txtBorrowMark.Text = borrowTemp.Mark; if (borrowTemp.IsNight) { labNightCost.ForeColor = Color.Red; labNightCost.Text = "包夜租车"; } else { labNightCost.Text = ""; } } catch (Exception) { MessageBox.Show("网络不稳定,请重新加载!"); } }
/// <summary> /// 删除租车类型 /// </summary> /// <param name="borrowKind"></param> /// <returns></returns> public bool BorrowKindDelete(BorrowKind borrowKind) { string sql = "BORROW_KIND_DELETE"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@BKID", SqlDbType.Int) }; para[0].Value = borrowKind.BkId; int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para); return(result > 0 ? true : false); } catch (Exception ex) { except.ExceptionInsert("删除租车类型出错:" + ex.Message, "BorrowKindDelete", DateTime.Now); return(false); } }
/// <summary> /// 租车类型添加 /// </summary> /// <param name="borrowKind"></param> /// <returns></returns> public bool BorrowKindInsert(BorrowKind borrowKind) { int result; try { string sql = "BORROW_KIND_INSERT"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@BBKNAME", SqlDbType.VarChar, 50) }; para[0].Value = borrowKind.BbkName; result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para); return(result > 0 ? true : false); } catch (Exception ex) { except.ExceptionInsert("添加租车类型出错:" + ex.Message, "BorrowKindInsert", DateTime.Now); return(false); } }
/// <summary> /// 根据BKID获得租车类型 /// </summary> /// <returns></returns> public BorrowKind BorrowKindSelectById(BorrowKind borrowKind) { return(borrowKindDal.BorrowKindSelectById(borrowKind)); }
/// <summary> /// 删除租车类型 /// </summary> /// <param name="borrowKind"></param> /// <returns></returns> public bool BorrowKindDelete(BorrowKind borrowKind) { return(borrowKindDal.BorrowKindDelete(borrowKind)); }
/// <summary> /// 租车类型添加 /// </summary> /// <param name="borrowKind"></param> /// <returns></returns> public bool BorrowKindInsert(BorrowKind borrowKind) { return(borrowKindDal.BorrowKindInsert(borrowKind)); }