public void HolidayAdd(HolidayInfo holidayinfo) { try { SPHoliday.HolidayAdd(holidayinfo); } catch (Exception ex) { MessageBox.Show("HSBll1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool HolidayAddWithIdentity(HolidayInfo holidayinfo) { bool isStatus = false; try { isStatus = spHoliday.HolidayAddWithIdentity(holidayinfo); } catch (Exception ex) { MessageBox.Show("SB3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isStatus; }
/// <summary> /// Function to insert values to Holiday table and return Id /// </summary> /// <param name="holidayinfo"></param> /// <returns></returns> public bool HolidayAddWithIdentity(HolidayInfo holidayinfo) { bool isSave = true; try { isSave = SPHoliday.HolidayAddWithIdentity(holidayinfo); } catch (Exception ex) { MessageBox.Show("HSBll8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isSave; }
/// <summary> /// Function to insert values to Holiday Table /// </summary> /// <param name="holidayinfo"></param> public void HolidayAdd(HolidayInfo holidayinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("HolidayAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@holidayId", SqlDbType.Decimal); sprmparam.Value = holidayinfo.HolidayId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = holidayinfo.Date; sprmparam = sccmd.Parameters.Add("@holidayName", SqlDbType.VarChar); sprmparam.Value = holidayinfo.HolidayName; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Narration; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = holidayinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from Holiday table based on the parameter /// </summary> /// <param name="holidayId"></param> /// <returns></returns> public HolidayInfo HolidayView(decimal holidayId) { HolidayInfo holidayinfo = new HolidayInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("HolidayView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@holidayId", SqlDbType.Decimal); sprmparam.Value = holidayId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { holidayinfo.HolidayId = decimal.Parse(sdrreader[0].ToString()); holidayinfo.Date = DateTime.Parse(sdrreader[1].ToString()); holidayinfo.HolidayName = sdrreader[2].ToString(); holidayinfo.Narration = sdrreader[3].ToString(); holidayinfo.ExtraDate = DateTime.Parse(sdrreader[4].ToString()); holidayinfo.Extra1 = sdrreader[5].ToString(); holidayinfo.Extra2 = sdrreader[6].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return holidayinfo; }
/// <summary> /// Function to insert values to Holiday table and return Id /// </summary> /// <param name="holidayinfo"></param> /// <returns></returns> public bool HolidayAddWithIdentity(HolidayInfo holidayinfo) { bool isSave = true; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("HolidayAddWithIdentity", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = holidayinfo.Date; sprmparam = sccmd.Parameters.Add("@holidayName", SqlDbType.VarChar); sprmparam.Value = holidayinfo.HolidayName; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Narration; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = holidayinfo.Extra2; int inAffected = sccmd.ExecuteNonQuery(); if (inAffected > 0) { isSave = true; } else { isSave = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return isSave; }
/// <summary> /// Function to get particular values from Holiday table based on the parameter /// </summary> /// <param name="holidayId"></param> /// <returns></returns> public HolidayInfo HolidayView(decimal holidayId) { HolidayInfo holidayinfo = new HolidayInfo(); try { holidayinfo=SPHoliday.HolidayView(holidayId); } catch (Exception ex) { MessageBox.Show("HSBll4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return holidayinfo; }