public ReminderInfo RemainderView(decimal remainder) { ReminderInfo infoReminder = new ReminderInfo(); try { infoReminder = spReminder.RemainderView( remainder); } catch (Exception ex) { MessageBox.Show("ROI2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return infoReminder; }
public bool RemainderEdit(ReminderInfo remainderinfo) { bool trueOrfalse = false; try { trueOrfalse = spReminder.RemainderEdit(remainderinfo); } catch (Exception ex) { MessageBox.Show("RM3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return trueOrfalse; }
/// <summary> /// Function to insert values to Remainder Table /// </summary> /// <param name="reminderinfo"></param> /// <returns></returns> public bool ReminderAdd(ReminderInfo reminderinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ReminderAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@fromDate", SqlDbType.DateTime); sprmparam.Value = reminderinfo.FromDate; sprmparam = sccmd.Parameters.Add("@toDate", SqlDbType.DateTime); sprmparam.Value = reminderinfo.ToDate; sprmparam = sccmd.Parameters.Add("@remindAbout", SqlDbType.VarChar); sprmparam.Value = reminderinfo.RemindAbout; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = reminderinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = reminderinfo.Extra2; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = reminderinfo.ExtraDate; int inEffectedRows = sccmd.ExecuteNonQuery(); if (inEffectedRows > 0) { return true; } else { return false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); return false; } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from Remainder Table based on the parameter /// </summary> /// <param name="remainder"></param> /// <returns></returns> public ReminderInfo RemainderView(decimal remainder) { ReminderInfo remainderinfo = new ReminderInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ReminderView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@reminderId", SqlDbType.Decimal); sprmparam.Value = remainder; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { remainderinfo.FromDate = DateTime.Parse(sdrreader["fromDate"].ToString()); remainderinfo.ToDate = DateTime.Parse(sdrreader["toDate"].ToString()); remainderinfo.RemindAbout = sdrreader["remindAbout"].ToString(); remainderinfo.Extra1 = sdrreader["extra1"].ToString(); remainderinfo.Extra2 = sdrreader["extra2"].ToString(); remainderinfo.ExtraDate = DateTime.Parse(sdrreader["extraDate"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return remainderinfo; }