/// <summary> /// Function to insert values to RejectionOutDetails Table /// </summary> /// <param name="rejectionoutdetailsinfo"></param> /// <returns></returns> public decimal RejectionOutDetailsAddWithReturnIdentity(RejectionOutDetailsInfo rejectionoutdetailsinfo) { decimal decIdentity = 0; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutDetailsAddWithReturnIdentity", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.RejectionOutMasterId; sprmparam = sccmd.Parameters.Add("@materialReceiptDetailsId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.MaterialReceiptDetailsId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.ProductId; sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Qty; sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Rate; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.UnitId; sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.UnitConversionId; sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.BatchId; sprmparam = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.GodownId; sprmparam = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.RackId; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Amount; sprmparam = sccmd.Parameters.Add("@slno", SqlDbType.Int); sprmparam.Value = rejectionoutdetailsinfo.Slno; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = rejectionoutdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = rejectionoutdetailsinfo.Extra2; Object obj = Convert.ToDecimal(sccmd.ExecuteScalar()); if (obj != null) { decIdentity = Convert.ToDecimal(obj); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(decIdentity); }
/// <summary> /// Function to Update values in RejectionOutDetails Table /// </summary> /// <param name="rejectionoutdetailsinfo"></param> public void RejectionOutDetailsEdit(RejectionOutDetailsInfo rejectionoutdetailsinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutDetailsEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutDetailsId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.RejectionOutDetailsId; sprmparam = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.RejectionOutMasterId; sprmparam = sccmd.Parameters.Add("@materialReceiptDetailsId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.MaterialReceiptDetailsId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.ProductId; sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Qty; sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Rate; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.UnitId; sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.UnitConversionId; sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.BatchId; sprmparam = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.GodownId; sprmparam = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.RackId; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = rejectionoutdetailsinfo.Amount; sprmparam = sccmd.Parameters.Add("@slno", SqlDbType.Int); sprmparam.Value = rejectionoutdetailsinfo.Slno; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = rejectionoutdetailsinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = rejectionoutdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = rejectionoutdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from RejectionOutDetails table based on the parameter /// </summary> /// <param name="rejectionOutDetailsId"></param> /// <returns></returns> public RejectionOutDetailsInfo RejectionOutDetailsView(decimal rejectionOutDetailsId) { RejectionOutDetailsInfo rejectionoutdetailsinfo = new RejectionOutDetailsInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutDetailsView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutDetailsId", SqlDbType.Decimal); sprmparam.Value = rejectionOutDetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { rejectionoutdetailsinfo.RejectionOutDetailsId = decimal.Parse(sdrreader[0].ToString()); rejectionoutdetailsinfo.RejectionOutMasterId = decimal.Parse(sdrreader[1].ToString()); rejectionoutdetailsinfo.MaterialReceiptDetailsId = decimal.Parse(sdrreader[2].ToString()); rejectionoutdetailsinfo.ProductId = decimal.Parse(sdrreader[3].ToString()); rejectionoutdetailsinfo.Qty = decimal.Parse(sdrreader[4].ToString()); rejectionoutdetailsinfo.Rate = decimal.Parse(sdrreader[5].ToString()); rejectionoutdetailsinfo.UnitId = decimal.Parse(sdrreader[6].ToString()); rejectionoutdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[7].ToString()); rejectionoutdetailsinfo.BatchId = decimal.Parse(sdrreader[8].ToString()); rejectionoutdetailsinfo.GodownId = decimal.Parse(sdrreader[9].ToString()); rejectionoutdetailsinfo.RackId = decimal.Parse(sdrreader[10].ToString()); rejectionoutdetailsinfo.Amount = decimal.Parse(sdrreader[11].ToString()); rejectionoutdetailsinfo.Slno = int.Parse(sdrreader[12].ToString()); rejectionoutdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[13].ToString()); rejectionoutdetailsinfo.Extra1 = sdrreader[14].ToString(); rejectionoutdetailsinfo.Extra2 = sdrreader[15].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(rejectionoutdetailsinfo); }