public void MonthlySalaryVoucherDetailsAdd(SalaryVoucherDetailsInfo salaryvoucherdetailsinfo) { try { SPSalaryVoucherDetails.MonthlySalaryVoucherDetailsAdd(salaryvoucherdetailsinfo); } catch (Exception ex) { MessageBox.Show("CN01:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values to MonthlySalaryVoucherDetails Table /// </summary> /// <param name="salaryvoucherdetailsinfo"></param> public void MonthlySalaryVoucherDetailsAdd(SalaryVoucherDetailsInfo salaryvoucherdetailsinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalaryVoucherDetailsAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salaryVoucherMasterId", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.SalaryVoucherMasterId; sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.EmployeeId; sprmparam = sccmd.Parameters.Add("@bonus", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.Bonus; sprmparam = sccmd.Parameters.Add("@deduction", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.Deduction; sprmparam = sccmd.Parameters.Add("@advance", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.Advance; sprmparam = sccmd.Parameters.Add("@lop", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.Lop; sprmparam = sccmd.Parameters.Add("@salary", SqlDbType.Decimal); sprmparam.Value = salaryvoucherdetailsinfo.Salary; sprmparam = sccmd.Parameters.Add("@status", SqlDbType.VarChar); sprmparam.Value = salaryvoucherdetailsinfo.Status; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = salaryvoucherdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = salaryvoucherdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from MonthlySalaryVoucherDetails Table based on the parameter /// </summary> /// <param name="salaryVoucherDetailsId"></param> /// <returns></returns> public SalaryVoucherDetailsInfo SalaryVoucherDetailsView(decimal salaryVoucherDetailsId) { SalaryVoucherDetailsInfo salaryvoucherdetailsinfo = new SalaryVoucherDetailsInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalaryVoucherDetailsView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salaryVoucherDetailsId", SqlDbType.Decimal); sprmparam.Value = salaryVoucherDetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { salaryvoucherdetailsinfo.SalaryVoucherDetailsId = decimal.Parse(sdrreader[0].ToString()); salaryvoucherdetailsinfo.SalaryVoucherMasterId = decimal.Parse(sdrreader[1].ToString()); salaryvoucherdetailsinfo.EmployeeId = decimal.Parse(sdrreader[2].ToString()); salaryvoucherdetailsinfo.Bonus = decimal.Parse(sdrreader[3].ToString()); salaryvoucherdetailsinfo.Deduction = decimal.Parse(sdrreader[4].ToString()); salaryvoucherdetailsinfo.Advance = decimal.Parse(sdrreader[5].ToString()); salaryvoucherdetailsinfo.Lop = decimal.Parse(sdrreader[6].ToString()); salaryvoucherdetailsinfo.Salary = decimal.Parse(sdrreader[7].ToString()); salaryvoucherdetailsinfo.Status = sdrreader[8].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return salaryvoucherdetailsinfo; }