public bool RackEdit(RackInfo rackinfo) { bool isEdit = false; try { isEdit = SPRack.RackEdit(rackinfo); } catch (Exception ex) { MessageBox.Show("RackBll 4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isEdit; }
public decimal RackAdd(RackInfo rackinfo) { decimal decEffectedRow = 0; try { decEffectedRow = SPRack.RackAdd(rackinfo); } catch (Exception ex) { MessageBox.Show("RackBll 3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return decEffectedRow; }
/// <summary> /// Function to insert values to Rack Table /// </summary> /// <param name="rackinfo"></param> /// <returns></returns> public decimal RackAdd(RackInfo rackinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RackAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rackName", SqlDbType.VarChar); sprmparam.Value = rackinfo.RackName; sprmparam = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal); sprmparam.Value = rackinfo.GodownId; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = rackinfo.Narration; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = rackinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = rackinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = rackinfo.Extra2; decimal decEffectedRow = Convert.ToDecimal(sccmd.ExecuteScalar()); if (decEffectedRow > 0) { return decEffectedRow; } else { return 0; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); return 0; } finally { sqlcon.Close(); } }
public RackInfo RackView(decimal rackId) { RackInfo rackinfo = new RackInfo(); try { rackinfo = SPRack.RackView(rackId); } catch (Exception ex) { MessageBox.Show("RackBll 6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return rackinfo; }
/// <summary> /// Function to get particular values from Rack Table based on the parameter /// </summary> /// <param name="rackId"></param> /// <returns></returns> public RackInfo RackView(decimal rackId) { RackInfo rackinfo = new RackInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RackView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal); sprmparam.Value = rackId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { rackinfo.RackId = decimal.Parse(sdrreader[0].ToString()); rackinfo.RackName = sdrreader[1].ToString(); rackinfo.GodownId = decimal.Parse(sdrreader[2].ToString()); rackinfo.Narration = sdrreader[3].ToString(); rackinfo.Extra1 = sdrreader[4].ToString(); rackinfo.Extra2 = sdrreader[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return rackinfo; }