/// <summary> /// Function to insert values to DailySalaryVoucherMaster Table and return the Curresponding row's Id /// </summary> /// <param name="dailysalaryvouchermasterinfo"></param> /// <param name="IsAutomatic"></param> /// <returns></returns> public DataTable DailySalaryVoucherMasterAddWithIdentity(DailySalaryVoucherMasterInfo dailysalaryvouchermasterinfo, bool IsAutomatic) { DataTable dtbl = new DataTable(); try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlDataAdapter sqlda = new SqlDataAdapter("DailySalaryVoucherMasterAddWithIdentity", sqlcon); sqlda.SelectCommand.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sqlda.SelectCommand.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.LedgerId; sprmparam = sqlda.SelectCommand.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.VoucherNo; sprmparam = sqlda.SelectCommand.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.InvoiceNo; sprmparam = sqlda.SelectCommand.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = dailysalaryvouchermasterinfo.Date; sprmparam = sqlda.SelectCommand.Parameters.Add("@salaryDate", SqlDbType.DateTime); sprmparam.Value = dailysalaryvouchermasterinfo.SalaryDate; sprmparam = sqlda.SelectCommand.Parameters.Add("@totalAmount", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.TotalAmount; sprmparam = sqlda.SelectCommand.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Narration; sprmparam = sqlda.SelectCommand.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Extra1; sprmparam = sqlda.SelectCommand.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Extra2; sprmparam = sqlda.SelectCommand.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.SuffixPrefixId; sprmparam = sqlda.SelectCommand.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.VoucherTypeId; sprmparam = sqlda.SelectCommand.Parameters.Add("@isAutomatic", SqlDbType.Bit); sprmparam.Value = IsAutomatic; sprmparam = sqlda.SelectCommand.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.FinancialYearId; sqlda.Fill(dtbl); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(dtbl); }
/// <summary> /// Function to insert values to DailySalaryVoucherMaster Table /// </summary> /// <param name="dailysalaryvouchermasterinfo"></param> public void DailySalaryVoucherMasterAdd(DailySalaryVoucherMasterInfo dailysalaryvouchermasterinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("DailySalaryVoucherMasterAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@dailySalaryVoucherMasterId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.DailySalaryVoucehrMasterId; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@voucherNumber", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNumber", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = dailysalaryvouchermasterinfo.Date; sprmparam = sccmd.Parameters.Add("@salaryDate", SqlDbType.DateTime); sprmparam.Value = dailysalaryvouchermasterinfo.SalaryDate; sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.TotalAmount; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = dailysalaryvouchermasterinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = dailysalaryvouchermasterinfo.Extra2; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = dailysalaryvouchermasterinfo.FinancialYearId; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from DailySalaryVoucherMaster Table based on the parameter /// </summary> /// <param name="dailySalaryVoucehrMasterId"></param> /// <returns></returns> public DailySalaryVoucherMasterInfo DailySalaryVoucherMasterView(decimal dailySalaryVoucehrMasterId) { DailySalaryVoucherMasterInfo dailysalaryvouchermasterinfo = new DailySalaryVoucherMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("DailySalaryVoucherMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@dailySalaryVoucherMasterId", SqlDbType.Decimal); sprmparam.Value = dailySalaryVoucehrMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { dailysalaryvouchermasterinfo.DailySalaryVoucehrMasterId = decimal.Parse(sdrreader[0].ToString()); dailysalaryvouchermasterinfo.LedgerId = decimal.Parse(sdrreader[1].ToString()); dailysalaryvouchermasterinfo.VoucherNo = sdrreader[2].ToString(); dailysalaryvouchermasterinfo.InvoiceNo = sdrreader[3].ToString(); dailysalaryvouchermasterinfo.Date = DateTime.Parse(sdrreader[4].ToString()); dailysalaryvouchermasterinfo.SalaryDate = DateTime.Parse(sdrreader[5].ToString()); dailysalaryvouchermasterinfo.TotalAmount = decimal.Parse(sdrreader[6].ToString()); dailysalaryvouchermasterinfo.Narration = sdrreader[7].ToString(); dailysalaryvouchermasterinfo.ExtraDate = DateTime.Parse(sdrreader[8].ToString()); dailysalaryvouchermasterinfo.Extra1 = sdrreader[9].ToString(); dailysalaryvouchermasterinfo.Extra2 = sdrreader[10].ToString(); dailysalaryvouchermasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[11].ToString()); dailysalaryvouchermasterinfo.VoucherTypeId = decimal.Parse(sdrreader[12].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(dailysalaryvouchermasterinfo); }
/// <summary> /// Function to Daily Salary Voucher View From Register /// </summary> /// <param name="decDailySalaryVoucehrMasterId"></param> /// <returns></returns> public DailySalaryVoucherMasterInfo DailySalaryVoucherViewFromRegister(decimal decDailySalaryVoucehrMasterId) { DailySalaryVoucherMasterInfo infoDailySalaryVoucherMaster = new DailySalaryVoucherMasterInfo(); SqlDataReader sqldr = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sqlcmd = new SqlCommand("DailySalaryVoucherViewFromRegister", sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.Add("@dailySalaryVoucherMasterId", SqlDbType.Decimal).Value = decDailySalaryVoucehrMasterId; sqldr = sqlcmd.ExecuteReader(); while (sqldr.Read()) { infoDailySalaryVoucherMaster.Date = Convert.ToDateTime(sqldr["date"].ToString()); infoDailySalaryVoucherMaster.VoucherNo = sqldr["voucherNo"].ToString(); infoDailySalaryVoucherMaster.InvoiceNo = sqldr["invoiceNo"].ToString(); infoDailySalaryVoucherMaster.SalaryDate = Convert.ToDateTime(sqldr["salaryDate"].ToString()); infoDailySalaryVoucherMaster.LedgerId = Convert.ToDecimal(sqldr["ledgerId"].ToString()); infoDailySalaryVoucherMaster.TotalAmount = Convert.ToDecimal(sqldr["totalAmount"].ToString()); infoDailySalaryVoucherMaster.Narration = sqldr["narration"].ToString(); infoDailySalaryVoucherMaster.VoucherTypeId = Convert.ToDecimal(sqldr["voucherTypeId"].ToString()); infoDailySalaryVoucherMaster.SuffixPrefixId = Convert.ToDecimal(sqldr["suffixPrefixId"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqldr.Close(); sqlcon.Close(); } return(infoDailySalaryVoucherMaster); }