/// <summary> /// Function to insert values to PayHead Table /// </summary> /// <param name="payheadinfo"></param> public void PayHeadAdd(PayHeadInfo payheadinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PayHeadAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@payHeadName", SqlDbType.VarChar); sprmparam.Value = payheadinfo.PayHeadName; sprmparam = sccmd.Parameters.Add("@type", SqlDbType.VarChar); sprmparam.Value = payheadinfo.Type; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = payheadinfo.Narration; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = payheadinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = payheadinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = payheadinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
public void PayHeadEdit(PayHeadInfo payheadinfo) { try { SPPayHead.PayHeadEdit(payheadinfo); } catch (Exception ex) { MessageBox.Show("CB:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get particular values from PayHead Table based on the parameter /// </summary> /// <param name="payHeadId"></param> /// <returns></returns> public PayHeadInfo PayHeadView(decimal payHeadId) { PayHeadInfo payheadinfo = new PayHeadInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PayHeadView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal); sprmparam.Value = payHeadId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { payheadinfo.PayHeadId = Convert.ToDecimal(sdrreader[0].ToString()); payheadinfo.PayHeadName = sdrreader[1].ToString(); payheadinfo.Type = sdrreader[2].ToString(); payheadinfo.Narration = sdrreader[3].ToString(); payheadinfo.ExtraDate = DateTime.Parse(sdrreader[4].ToString()); payheadinfo.Extra1 = sdrreader[5].ToString(); payheadinfo.Extra2 = sdrreader[6].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return payheadinfo; }
public PayHeadInfo PayHeadView(decimal payHeadId) { try { InfoPayHead = SPPayHead.PayHeadView(payHeadId); } catch (Exception ex) { MessageBox.Show("CB:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return InfoPayHead; }