private void bt_Delete_Click(object sender, EventArgs e) { if (dgv_Block.SelectedRows == null) { return; } if (dgv_Block.SelectedRows.Count <= 0) { return; } if (dgv_Block.SelectedRows[0].Tag == null) { return; } BlockPriceRich bk = (BlockPriceRich)dgv_Block.SelectedRows[0].Tag; if (bk._blockPrice != null && bk._blockPrice.BlockPriceId.Trim().Length > 0) { bool bR = BlockPrice.DeleteObj(bk._blockPrice); if (bR) { _bChange = true; FillData(); } } }
private void btnSeatInfoSubmit_Click(object sender, EventArgs e) { BlockPrice blk = BuildBlock(); if (blk == null) { return; } bool bR = true; if (blk.BlockPriceId.Trim().Length <= 0) { bR = BlockPrice.CreateObj(blk); } else { bR = BlockPrice.UpdateObj(blk); } if (bR) { //if (_frmContainer._SimBlockObj != null) // _frmContainer._SimBlockObj._blockPrice = blk; _bChange = true; FillData(); MessageBox.Show("提交数据成功!"); } else { MessageBox.Show("提交数据失败!"); } }
public static BlockPrice RetrieveObj(string szShowPlanId, string szBlockId) { BlockDbo dbo = new BlockDbo(); DataTable dt = dbo.RetrieveALLItems(szShowPlanId, szBlockId); if (dt == null || dt.Rows.Count <= 0) { return(null); } BlockPrice obj = ChangeObj(dt.Rows[0]); return(obj); }
private BlockPrice BuildBlock() { if (_frmContainer == null) { return(null); } if (_frmContainer._seatingChart == null) { return(null); } if (_frmContainer._seatingChart.SeatingChartId.Trim().Length <= 0) { MessageBox.Show("必须选择一个座位图!", "系统提示"); return(null); } if (tb_BlockName.Text.Trim().Length <= 0) { MessageBox.Show("区域名称不能为空!", "系统提示"); return(null); } if (tb_BlockName.Tag == null) { MessageBox.Show("必须选定一个区域进行设置!", "系统提示"); return(null); } try { decimal deciSinglePrice = decimal.Parse(tb_SinglePrice.Text); decimal deciDoublePrice = decimal.Parse(tb_DoublePrice.Text); decimal deciBoxPrice = decimal.Parse(tb_BoxPrice.Text); decimal deciStudentPrice = decimal.Parse(tb_StudentPrice.Text); BlockPrice blk = new BlockPrice(); blk.ShowPlanId = _frmContainer._ShowPlanId; blk.BlockId = ((BlockPriceRich)tb_BlockName.Tag)._block.BlockId; blk.BlockPriceId = ((BlockPriceRich)tb_BlockName.Tag)._blockPrice.BlockPriceId; blk.SinglePrice = deciSinglePrice; blk.DoublePrice = deciDoublePrice; blk.BoxPrice = deciBoxPrice; blk.StudentPrice = deciStudentPrice; return(blk); } catch (Exception ex) { throw ex; } }
public static List <BlockPriceRich> RetrieveObjList(string szSeatingChartId, string szShowPlanId) { List <BlockPriceRich> list = new List <BlockPriceRich>(); BlockDbo dbo = new BlockDbo(); DataTable dt = dbo.RetrieveALLItems_Ext(szSeatingChartId, szShowPlanId); if (dt == null || dt.Rows.Count <= 0) { return(list); } foreach (DataRow dr in dt.Rows) { BlockPriceRich bpR = new BlockPriceRich(); bpR._block = Block.ChangeObj(dr); bpR._blockPrice = BlockPrice.ChangeObj(dr); list.Add(bpR); } return(list); }
public static List <BlockPrice> RetrieveObjList(string szShowPlanId) { List <BlockPrice> list = new List <BlockPrice>(); BlockPriceDbo dbo = new BlockPriceDbo(); DataTable dt = dbo.RetrieveALLItems(szShowPlanId); if (dt == null || dt.Rows.Count <= 0) { return(list); } foreach (DataRow dr in dt.Rows) { BlockPrice obj = ChangeObj(dr); if (obj != null) { list.Add(obj); } } return(list); }
public static BlockPrice ChangeObj(DataRow dr) { BlockPrice obj = new BlockPrice(); obj.BlockPriceId = dr["BlockPriceId"] == DBNull.Value ? "" : dr["BlockPriceId"].ToString(); obj.BlockId = dr["BlockId"] == DBNull.Value ? "" : dr["BlockId"].ToString(); obj.ShowPlanId = dr["ShowPlanId"] == DBNull.Value ? "" : dr["ShowPlanId"].ToString(); obj.SinglePrice = dr["SinglePrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["SinglePrice"]); obj.DoublePrice = dr["DoublePrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["DoublePrice"]); obj.BoxPrice = dr["BoxPrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["BoxPrice"]); obj.StudentPrice = dr["StudentPrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["StudentPrice"]); obj.GroupPrice = dr["GroupPrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["GroupPrice"]); obj.MemberPrice = dr["MemberPrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["MemberPrice"]); obj.DiscountPrice = dr["DiscountPrice"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["DiscountPrice"]); obj.Created = dr["Created"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["Created"]); obj.Updated = dr["Updated"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["Updated"]); obj.ActiveFlag = dr["ActiveFlag"] == DBNull.Value ? 1 : Convert.ToInt32(dr["ActiveFlag"]); return(obj); }
public static bool DeleteObj(BlockPrice bk) { BlockPriceDbo dbo = new BlockPriceDbo(); BlockPricePo po = new BlockPricePo(); po.BLOCKPRICEID = bk.BlockPriceId; po.BLOCKID = bk.BlockId; po.SHOWPLANID = bk.ShowPlanId; po.SINGLEPRICE = bk.SinglePrice; po.DOUBLEPRICE = bk.DoublePrice; po.BOXPRICE = bk.BoxPrice; po.STUDENTPRICE = bk.StudentPrice; po.GROUPPRICE = bk.GroupPrice; po.MEMBERPRICE = bk.MemberPrice; po.DISCOUNTPRICE = bk.DiscountPrice; po.CREATED = bk.Created; po.UPDATED = DateTime.Now; po.ACTIVEFLAG = bk.ActiveFlag; return(dbo.Delete(po)); }