/// <summary> /// Function to get details based on parameter /// </summary> /// <param name="dcProductid"></param> /// <returns></returns> public UnitConvertionInfo UnitViewAllByProductId(decimal dcProductid) { UnitConvertionInfo UnitConvertionInfo = new UnitConvertionInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("UnitViewAllByProductId", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = dcProductid; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { UnitConvertionInfo.UnitconvertionId = decimal.Parse(sdrreader["unitconversionId"].ToString()); UnitConvertionInfo.UnitId = decimal.Parse(sdrreader["unitId"].ToString()); UnitConvertionInfo.ConversionRate = decimal.Parse(sdrreader["conversionRate"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return UnitConvertionInfo; }
/// <summary> /// Function to get particular values from UnitConversion table based on the parameter /// </summary> /// <param name="unitconvertionId"></param> /// <returns></returns> public UnitConvertionInfo UnitConvertionView(decimal unitconvertionId) { UnitConvertionInfo unitconvertioninfo = new UnitConvertionInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("UnitConvertionView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@unitconvertionId", SqlDbType.Decimal); sprmparam.Value = unitconvertionId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { unitconvertioninfo.UnitconvertionId = decimal.Parse(sdrreader[0].ToString()); unitconvertioninfo.ProductId = decimal.Parse(sdrreader[1].ToString()); unitconvertioninfo.UnitId = decimal.Parse(sdrreader[2].ToString()); unitconvertioninfo.ConversionRate = decimal.Parse(sdrreader[3].ToString()); unitconvertioninfo.ExtraDate = DateTime.Parse(sdrreader[4].ToString()); unitconvertioninfo.Extra1 = sdrreader[5].ToString(); unitconvertioninfo.Extra2 = sdrreader[6].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return unitconvertioninfo; }
/// <summary> /// Function to get all the values from UnitConversion table /// </summary> /// <param name="unitconvertioninfo"></param> public void UnitConvertionEdit(UnitConvertionInfo unitconvertioninfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("UnitConvertionEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@unitconvertionId", SqlDbType.Decimal); sprmparam.Value = unitconvertioninfo.UnitconvertionId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = unitconvertioninfo.ProductId; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = unitconvertioninfo.UnitId; sprmparam = sccmd.Parameters.Add("@conversionRate", SqlDbType.Decimal); sprmparam.Value = unitconvertioninfo.ConversionRate; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = unitconvertioninfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = unitconvertioninfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = unitconvertioninfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get details based on parameter /// </summary> /// <param name="unitConvertionInfo"></param> public void UnitConverstionEditWhenProductUpdating(UnitConvertionInfo unitConvertionInfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("UnitConverstionEditWhenProductUpdating", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = unitConvertionInfo.ProductId; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = unitConvertionInfo.UnitId; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
public UnitConvertionInfo UnitViewAllByProductId(decimal dcProductid) { UnitConvertionInfo infUnitConvertion = new UnitConvertionInfo(); try { infUnitConvertion = spUnitConvertion.UnitViewAllByProductId(dcProductid); } catch (Exception ex) { MessageBox.Show("ROI2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return infUnitConvertion; }
public void UnitConvertionEdit(UnitConvertionInfo unitconvertioninfo) { try { spUnitConvertion.UnitConvertionEdit(unitconvertioninfo); } catch (Exception ex) { MessageBox.Show("ROI2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }