/// <summary> /// Function to Update values in PDCPayableMaster Table /// </summary> /// <param name="pdcpayablemasterinfo"></param> public void PDCPayableMasterEdit(PDCPayableMasterInfo pdcpayablemasterinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PDCPayableMasterEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@pdcPayableMasterId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.PdcPayableMasterId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = pdcpayablemasterinfo.Date; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.Amount; sprmparam = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.ChequeNo; sprmparam = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime); sprmparam.Value = pdcpayablemasterinfo.ChequeDate; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.UserId; sprmparam = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.BankId; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = pdcpayablemasterinfo.FinancialYearId; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = pdcpayablemasterinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from PDCPayableMaster table based on the parameter /// </summary> /// <param name="pdcPayableMasterId"></param> /// <returns></returns> public PDCPayableMasterInfo PDCPayableMasterView(decimal pdcPayableMasterId) { PDCPayableMasterInfo pdcpayablemasterinfo = new PDCPayableMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PDCPayableMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@pdcPayableMasterId", SqlDbType.Decimal); sprmparam.Value = pdcPayableMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { pdcpayablemasterinfo.PdcPayableMasterId = decimal.Parse(sdrreader[0].ToString()); pdcpayablemasterinfo.VoucherNo = sdrreader[1].ToString(); pdcpayablemasterinfo.InvoiceNo = sdrreader[2].ToString(); pdcpayablemasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString()); pdcpayablemasterinfo.Date = DateTime.Parse(sdrreader[4].ToString()); pdcpayablemasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString()); pdcpayablemasterinfo.Amount = decimal.Parse(sdrreader[6].ToString()); pdcpayablemasterinfo.ChequeNo = sdrreader[7].ToString(); pdcpayablemasterinfo.ChequeDate = DateTime.Parse(sdrreader[8].ToString()); pdcpayablemasterinfo.Narration = sdrreader[9].ToString(); pdcpayablemasterinfo.UserId = decimal.Parse(sdrreader[10].ToString()); pdcpayablemasterinfo.BankId = decimal.Parse(sdrreader[11].ToString()); pdcpayablemasterinfo.VoucherTypeId = decimal.Parse(sdrreader[12].ToString()); pdcpayablemasterinfo.FinancialYearId = decimal.Parse(sdrreader[13].ToString()); pdcpayablemasterinfo.ExtraDate = DateTime.Parse(sdrreader[14].ToString()); pdcpayablemasterinfo.Extra1 = sdrreader[15].ToString(); pdcpayablemasterinfo.Extra2 = sdrreader[16].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(pdcpayablemasterinfo); }