/// <summary> /// Function to Update values in account group Table /// </summary> /// <param name="creditnotemasterinfo"></param> /// <returns></returns> public decimal CreditNoteMasterEdit(CreditNoteMasterInfo creditnotemasterinfo) { decimal decCreditNoteMaster = 0; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("CreditNoteMasterEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@creditNoteMasterId", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.CreditNoteMasterId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = creditnotemasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = creditnotemasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = creditnotemasterinfo.Date; sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.UserId; sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.TotalAmount; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = creditnotemasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.FinancialYearId; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = creditnotemasterinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = creditnotemasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = creditnotemasterinfo.Extra2; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = creditnotemasterinfo.VoucherTypeId; decCreditNoteMaster = sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(decCreditNoteMaster); }
/// <summary> /// Function to get particular values from account CreditNoteMaster based on the parameter /// </summary> /// <param name="creditNoteMasterId"></param> /// <returns></returns> public CreditNoteMasterInfo CreditNoteMasterView(decimal creditNoteMasterId) { CreditNoteMasterInfo creditnotemasterinfo = new CreditNoteMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("CreditNoteMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@creditNoteMasterId", SqlDbType.Decimal); sprmparam.Value = creditNoteMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { creditnotemasterinfo.CreditNoteMasterId = decimal.Parse(sdrreader[0].ToString()); creditnotemasterinfo.VoucherNo = sdrreader[1].ToString(); creditnotemasterinfo.InvoiceNo = sdrreader[2].ToString(); creditnotemasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString()); creditnotemasterinfo.Date = DateTime.Parse(sdrreader[4].ToString()); creditnotemasterinfo.VoucherTypeId = decimal.Parse(sdrreader[5].ToString()); creditnotemasterinfo.UserId = decimal.Parse(sdrreader[6].ToString()); creditnotemasterinfo.TotalAmount = decimal.Parse(sdrreader[7].ToString()); creditnotemasterinfo.Narration = sdrreader[8].ToString(); creditnotemasterinfo.FinancialYearId = decimal.Parse(sdrreader[9].ToString()); creditnotemasterinfo.ExtraDate = DateTime.Parse(sdrreader[10].ToString()); creditnotemasterinfo.Extra1 = sdrreader[11].ToString(); creditnotemasterinfo.Extra2 = sdrreader[12].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(creditnotemasterinfo); }