public void AdvancePaymentEdit(AdvancePaymentInfo advancepaymentinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("AdvancePaymentEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@advancePaymentId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.AdvancePaymentId; sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.EmployeeId; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = advancepaymentinfo.Date; sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.Amount; sprmparam = sccmd.Parameters.Add("@salaryMonth", SqlDbType.DateTime); sprmparam.Value = advancepaymentinfo.SalaryMonth; sprmparam = sccmd.Parameters.Add("@chequenumber", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.Chequenumber; sprmparam = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime); sprmparam.Value = advancepaymentinfo.ChequeDate; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.Narration; //sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); //sprmparam.Value = advancepaymentinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = advancepaymentinfo.Extra2; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = advancepaymentinfo.FinancialYearId; //sccmd.ExecuteScalar(); sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
public AdvancePaymentInfo AdvancePaymentView(decimal advancePaymentId) { AdvancePaymentInfo advancepaymentinfo = new AdvancePaymentInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("AdvancePaymentView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@advancePaymentId", SqlDbType.Decimal); sprmparam.Value = advancePaymentId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { advancepaymentinfo.AdvancePaymentId = Convert.ToDecimal(sdrreader[0].ToString()); advancepaymentinfo.EmployeeId = Convert.ToDecimal(sdrreader[1].ToString()); advancepaymentinfo.LedgerId = Convert.ToDecimal(sdrreader[2].ToString()); advancepaymentinfo.VoucherNo = sdrreader[3].ToString(); advancepaymentinfo.InvoiceNo = (sdrreader[4].ToString()); advancepaymentinfo.Date = Convert.ToDateTime(sdrreader[5].ToString()); advancepaymentinfo.Amount = Convert.ToDecimal(sdrreader[6].ToString()); advancepaymentinfo.SalaryMonth = Convert.ToDateTime(sdrreader[7].ToString()); advancepaymentinfo.Chequenumber = sdrreader[8].ToString(); advancepaymentinfo.ChequeDate = Convert.ToDateTime(sdrreader[9].ToString()); advancepaymentinfo.Narration = sdrreader[10].ToString(); advancepaymentinfo.ExtraDate = Convert.ToDateTime(sdrreader[11].ToString()); advancepaymentinfo.Extra1 = sdrreader[12].ToString(); advancepaymentinfo.Extra2 = sdrreader[13].ToString(); advancepaymentinfo.SuffixPrefixId = Convert.ToDecimal(sdrreader[14].ToString()); advancepaymentinfo.VoucherTypeId = Convert.ToDecimal(sdrreader[15].ToString()); advancepaymentinfo.FinancialYearId = Convert.ToDecimal(sdrreader[16].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(advancepaymentinfo); }