/// <summary>
        /// Fills controls for updation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvRemainder_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            RemainderBll bllRemainder = new RemainderBll();

            try
            {
                if (dgvRemainder.CurrentRow != null)
                {
                    if (dgvRemainder.CurrentRow.Cells["reminderId"].Value != null)
                    {
                        if (dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString() != string.Empty)
                        {
                            decReminderId = Convert.ToDecimal(dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString());

                            ReminderInfo infoReminder = new ReminderInfo();
                            infoReminder        = bllRemainder.RemainderView(decReminderId);
                            dtpFromDate.Value   = infoReminder.FromDate;
                            dtpToDate.Value     = infoReminder.ToDate;
                            txtRemindAbout.Text = infoReminder.RemindAbout;
                            txtFromDate.Focus();
                            btnSave.Text      = "Update";
                            btnDelete.Enabled = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PREM12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
 /// <summary>
 /// Fills controls for updation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRemainder_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvRemainder.CurrentRow != null)
         {
             if (dgvRemainder.CurrentRow.Cells["reminderId"].Value != null)
             {
                 if (dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString() != string.Empty)
                 {
                     decReminderId = Convert.ToDecimal(dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString());
                     ReminderSP   spreminder   = new ReminderSP();
                     ReminderInfo infoReminder = new ReminderInfo();
                     infoReminder     = spreminder.RemainderView(decReminderId);
                     txtFromDate.Text = infoReminder.FromDate.ToString("dd-MMM-yyyy");
                     txtToDate.Text   = infoReminder.ToDate.ToString("dd-MMM-yyyy");
                     //dtpFromDate.Value = infoReminder.FromDate;
                     //dtpToDate.Value = infoReminder.ToDate;
                     txtRemindAbout.Text = infoReminder.RemindAbout;
                     txtFromDate.Focus();
                     btnSave.Text      = "Update";
                     btnDelete.Enabled = true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREM12:" + ex.Message;
     }
 }
Example #3
0
 /// <summary>
 /// Function to Update values in Remainder Table
 /// </summary>
 /// <param name="remainderinfo"></param>
 /// <returns></returns>
 public bool RemainderEdit(ReminderInfo remainderinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReminderEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@reminderId", SqlDbType.Decimal);
         sprmparam.Value = remainderinfo.ReminderId;
         sprmparam       = sccmd.Parameters.Add("@fromDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.FromDate;
         sprmparam       = sccmd.Parameters.Add("@toDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.ToDate;
         sprmparam       = sccmd.Parameters.Add("@remindAbout", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.RemindAbout;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.Extra2;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.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();
     }
 }
Example #4
0
 /// <summary>
 /// Function to Update values in Remainder Table
 /// </summary>
 /// <param name="remainderinfo"></param>
 /// <returns></returns>
 public bool RemainderEdit(ReminderInfo remainderinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReminderEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@reminderId", SqlDbType.Decimal);
         sprmparam.Value = remainderinfo.ReminderId;
         sprmparam = sccmd.Parameters.Add("@fromDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.FromDate;
         sprmparam = sccmd.Parameters.Add("@toDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.ToDate;
         sprmparam = sccmd.Parameters.Add("@remindAbout", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.RemindAbout;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = remainderinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = remainderinfo.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();
     }
 }
Example #5
0
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ReminderSP   spReminder   = new ReminderSP();
         ReminderInfo infoReminder = new ReminderInfo();
         infoReminder.FromDate    = dtpFromDate.Value;
         infoReminder.ToDate      = dtpToDate.Value;
         infoReminder.RemindAbout = txtRemindAbout.Text.Trim();
         infoReminder.Extra1      = PublicVariables._decCurrentUserId.ToString();
         infoReminder.Extra2      = string.Empty;
         infoReminder.ExtraDate   = DateTime.Now;
         if (spReminder.ReminderAdd(infoReminder))
         {
             Messages.SavedMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREM2:" + ex.Message;
     }
 }
Example #6
0
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ReminderSP   spReminder   = new ReminderSP();
         ReminderInfo infoReminder = new ReminderInfo();
         infoReminder.FromDate    = dtpFromDate.Value;
         infoReminder.ToDate      = dtpToDate.Value;
         infoReminder.RemindAbout = txtRemindAbout.Text.Trim();
         infoReminder.Extra1      = string.Empty;
         infoReminder.Extra2      = string.Empty;
         infoReminder.ExtraDate   = DateTime.Now;
         if (spReminder.ReminderAdd(infoReminder))
         {
             Messages.SavedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #7
0
        /// <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);
        }
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RemainderBll bllRemainder = new RemainderBll();
         ReminderInfo infoReminder = new ReminderInfo();
         infoReminder.ReminderId  = decReminderId;
         infoReminder.FromDate    = dtpFromDate.Value;
         infoReminder.ToDate      = dtpToDate.Value;
         infoReminder.RemindAbout = txtRemindAbout.Text.Trim();
         infoReminder.Extra1      = PublicVariables._decCurrentUserId.ToString();
         infoReminder.Extra2      = string.Empty;
         infoReminder.ExtraDate   = DateTime.Now;
         if (bllRemainder.RemainderEdit(infoReminder))
         {
             Messages.UpdatedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #9
0
 /// <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;
 }
 /// <summary>
 /// Fills controls for updation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRemainder_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvRemainder.CurrentRow != null)
         {
             if (dgvRemainder.CurrentRow.Cells["reminderId"].Value != null)
             {
                 if (dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString() != string.Empty)
                 {
                     decReminderId = Convert.ToDecimal(dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString());
                     ReminderSP spreminder = new ReminderSP();
                     ReminderInfo infoReminder = new ReminderInfo();
                     infoReminder = spreminder.RemainderView(decReminderId);
                     txtFromDate.Text = infoReminder.FromDate.ToString("dd-MMM-yyyy");
                     txtToDate.Text = infoReminder.ToDate.ToString("dd-MMM-yyyy");
                     //dtpFromDate.Value = infoReminder.FromDate;
                     //dtpToDate.Value = infoReminder.ToDate;
                     txtRemindAbout.Text = infoReminder.RemindAbout;
                     txtFromDate.Focus();
                     btnSave.Text = "Update";
                     btnDelete.Enabled = true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         ReminderSP spReminder = new ReminderSP();
         ReminderInfo infoReminder = new ReminderInfo();
         infoReminder.ReminderId = decReminderId;
         infoReminder.FromDate = dtpFromDate.Value;
         infoReminder.ToDate = dtpToDate.Value;
         infoReminder.RemindAbout = txtRemindAbout.Text.Trim();
         infoReminder.Extra1 = string.Empty;
         infoReminder.Extra2 = string.Empty;
         infoReminder.ExtraDate = DateTime.Now;
         if (spReminder.RemainderEdit(infoReminder))
         {
             Messages.UpdatedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }