public SalesOrderDetailsInfo QuantityEditingAfterCheckingSalesQuotationForSalesOrder(decimal decSalesOrderId, decimal decProductId) { SalesOrderDetailsInfo infoSalesOrderDetails = new SalesOrderDetailsInfo(); SqlDataReader sdrReader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("QuantityEditingAfterCheckingSalesQuotationForSalesOrder", sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sqlcmd.Parameters.Add("@salesOrderMasterId", SqlDbType.Decimal); sprmparam.Value = decSalesOrderId; sprmparam = sqlcmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = decProductId; sdrReader = sqlcmd.ExecuteReader(); while (sdrReader.Read()) { infoSalesOrderDetails.Qty = Convert.ToDecimal(sdrReader["Qty"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrReader.Close(); sqlcon.Close(); } return(infoSalesOrderDetails); }
/// <summary> /// Function to Update values in SalesOrderDetails Table /// </summary> /// <param name="salesorderdetailsinfo"></param> public void SalesOrderDetailsEdit(SalesOrderDetailsInfo salesorderdetailsinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesOrderDetailsEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salesOrderDetailsId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.SalesOrderDetailsId; sprmparam = sccmd.Parameters.Add("@salesOrderMasterId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.SalesOrderMasterId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.ProductId; sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.Qty; sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.Rate; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.UnitId; sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.UnitConversionId; //sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal); //sprmparam.Value = salesorderdetailsinfo.ExchangeRateId; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.Amount; sprmparam = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.QuotationDetailsId; sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam.Value = salesorderdetailsinfo.BatchId; sprmparam = sccmd.Parameters.Add("@slNo", SqlDbType.Int); sprmparam.Value = salesorderdetailsinfo.SlNo; // sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); // sprmparam.Value = salesorderdetailsinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = salesorderdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = salesorderdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from SalesOrderDetails Table based on the parameter /// </summary> /// <param name="salesOrderDetailsId"></param> /// <returns></returns> public SalesOrderDetailsInfo SalesOrderDetailsView(decimal salesOrderDetailsId) { SalesOrderDetailsInfo salesorderdetailsinfo = new SalesOrderDetailsInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesOrderDetailsView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salesOrderDetailsId", SqlDbType.Decimal); sprmparam.Value = salesOrderDetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { salesorderdetailsinfo.SalesOrderDetailsId = decimal.Parse(sdrreader[0].ToString()); salesorderdetailsinfo.SalesOrderMasterId = decimal.Parse(sdrreader[1].ToString()); salesorderdetailsinfo.ProductId = decimal.Parse(sdrreader[2].ToString()); salesorderdetailsinfo.Qty = decimal.Parse(sdrreader[3].ToString()); salesorderdetailsinfo.Rate = decimal.Parse(sdrreader[4].ToString()); salesorderdetailsinfo.UnitId = decimal.Parse(sdrreader[5].ToString()); salesorderdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[6].ToString()); salesorderdetailsinfo.Amount = decimal.Parse(sdrreader[7].ToString()); salesorderdetailsinfo.QuotationDetailsId = decimal.Parse(sdrreader[8].ToString()); salesorderdetailsinfo.SlNo = int.Parse(sdrreader[9].ToString()); salesorderdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[10].ToString()); salesorderdetailsinfo.Extra1 = sdrreader[11].ToString(); salesorderdetailsinfo.Extra2 = sdrreader[12].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(salesorderdetailsinfo); }