protected void btnSave_Click(object sender, EventArgs e)
    {
        ReminderBO reminderBO     = null;
        DataSet    dataSet        = null;
        string     str            = "";
        string     str1           = "";
        string     sZCASEID       = "";
        string     str2           = "";
        DateTime   dateTime       = DateTime.Now.AddYears(2);
        DateTime   dateTime1      = Convert.ToDateTime(dateTime.ToShortDateString());
        int        num            = 0;
        int        num1           = 0;
        int        num2           = 0;
        int        num3           = 0;
        int        num4           = 0;
        int        num5           = 0;
        int        num6           = 0;
        int        num7           = 0;
        int        num8           = 0;
        int        num9           = 0;
        int        num10          = 0;
        int        num11          = 0;
        int        num12          = 0;
        int        num13          = 0;
        int        num14          = 0;
        int        num15          = 0;
        int        num16          = 0;
        int        selectedIndex  = 100;
        int        selectedIndex1 = 100;
        int        num17          = 0;
        int        num18          = 0;
        int        selectedIndex2 = 100;
        int        num19          = 0;
        int        selectedIndex3 = 100;
        int        selectedIndex4 = 100;
        int        selectedIndex5 = 100;
        string     str3           = "RS000000000000000001";

        try
        {
            try
            {
                if (this.txtReminderDesc.Text.Trim().ToString() == "")
                {
                    if (!this.chkRecurrence.Checked)
                    {
                        this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "none");
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Note description should not be empty...!!')", true);
                        return;
                    }
                    else
                    {
                        this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Note description should not be empty...!!')", true);
                        return;
                    }
                }
                else if (this.txtStartDate.Text == "")
                {
                    if (!this.chkRecurrence.Checked)
                    {
                        this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "none");
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('start date should not be empty...!!')", true);
                        return;
                    }
                    else
                    {
                        this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('start date should not be empty...!!')", true);
                        return;
                    }
                }
                else if (!this.rbtnWeekly.Checked || this.chkWSunday.Checked || this.chkWMonday.Checked || this.chkWTuesday.Checked || this.chkWWednesday.Checked || this.chkWThursday.Checked || this.chkWFriday.Checked || this.chkWSaturday.Checked)
                {
                    str = this.txtReminderDesc.Text.Trim().ToString();
                    str = str.Replace('\n', ' ');
                    str = str.Replace('\r', ' ');
                    if (this.txtUserID.Text != "")
                    {
                        str1 = this.txtUserID.Text.Trim().ToString();
                    }
                    DateTime dateTime2 = Convert.ToDateTime(this.txtStartDate.Text.Trim().ToString());
                    this.lsbAssignTo.SelectedValue.ToString();
                    if (!this.chkRecurrence.Checked)
                    {
                        num2       = 1;
                        dateTime1  = Convert.ToDateTime(this.txtStartDate.Text.Trim().ToString());
                        reminderBO = new ReminderBO();
                        if ((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"] != null)
                        {
                            sZCASEID = ((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_CASE_ID;
                        }
                        if (this.Session["SZ_REMINDER_DOCTOR_ID"] != null)
                        {
                            str2 = this.Session["SZ_REMINDER_DOCTOR_ID"].ToString();
                        }
                        string value       = "";
                        string sZCOMPANYID = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                        foreach (ListItem item in this.lsbAssignTo.Items)
                        {
                            if (!item.Selected)
                            {
                                continue;
                            }
                            value   = item.Value;
                            dataSet = reminderBO.SetReminderDetailsAdd(str, value, str1, str3, dateTime2, dateTime1, num, num1, num2, num3, num4, num5, num6, num7, num8, num9, num10, num11, num12, num13, num14, num15, num16, selectedIndex, selectedIndex1, num17, num18, selectedIndex2, num19, selectedIndex3, selectedIndex4, selectedIndex5, str2, sZCASEID, sZCOMPANYID, "CASE", this.extddlRType.Text, this.extddlRType.Selected_Text.ToString());
                        }
                    }
                    else
                    {
                        num = 1;
                        if (this.rbtnNoEndDate.Checked)
                        {
                            DateTime dateTime3 = DateTime.Now.AddYears(2);
                            dateTime1 = Convert.ToDateTime(dateTime3.ToShortDateString());
                        }
                        else if (this.rbtnEndBy.Checked)
                        {
                            dateTime1 = Convert.ToDateTime(this.txtEndByDate.Text.Trim().ToString());
                        }
                        else if (this.rbtnEndAfter.Checked)
                        {
                            num1 = 4;
                            num2 = Convert.ToInt32(this.txtEndAfter.Text.Trim().ToString());
                            DateTime dateTime4 = Convert.ToDateTime(this.txtStartDate.Text.Trim().ToString());
                            dateTime1 = dateTime4.AddDays(Convert.ToDouble(num2));
                        }
                        if (!(dateTime2.ToString() != "") || !(dateTime1.ToString() != "") || !(dateTime2 > dateTime1))
                        {
                            if (this.rbtnDaily.Checked)
                            {
                                num1 = 0;
                                if (!this.rbtnDEvery.Checked)
                                {
                                    num5 = 1;
                                    num3 = 1;
                                }
                                else
                                {
                                    num4 = Convert.ToInt32(this.txtDDays.Text.Trim().ToString());
                                    num3 = 0;
                                }
                            }
                            else if (this.rbtnWeekly.Checked)
                            {
                                num1 = 1;
                                num6 = Convert.ToInt32(this.txtWRecur.Text.Trim().ToString());
                                if (this.chkWSunday.Checked)
                                {
                                    num7 = 1;
                                }
                                if (this.chkWMonday.Checked)
                                {
                                    num8 = 1;
                                }
                                if (this.chkWTuesday.Checked)
                                {
                                    num9 = 1;
                                }
                                if (this.chkWWednesday.Checked)
                                {
                                    num10 = 1;
                                }
                                if (this.chkWThursday.Checked)
                                {
                                    num11 = 1;
                                }
                                if (this.chkWFriday.Checked)
                                {
                                    num12 = 1;
                                }
                                if (this.chkWSaturday.Checked)
                                {
                                    num13 = 1;
                                }
                            }
                            else if (this.rbtnMonthly.Checked)
                            {
                                num1 = 2;
                                if (!this.rbtnMDay.Checked)
                                {
                                    num14          = 1;
                                    selectedIndex  = this.drpMTerm.SelectedIndex;
                                    selectedIndex1 = this.drpMDayRecur.SelectedIndex;
                                    num17          = Convert.ToInt32(this.txtMEveryMonths.Text.Trim().ToString());
                                }
                                else
                                {
                                    num14 = 0;
                                    num15 = Convert.ToInt32(this.txtMDay.Text.Trim().ToString());
                                    num16 = Convert.ToInt32(this.txtMMonths.Text.Trim().ToString());
                                }
                            }
                            else if (this.rbtnYearly.Checked)
                            {
                                num1 = 3;
                                if (!this.rbtnYEvery.Checked)
                                {
                                    num18          = 1;
                                    selectedIndex3 = this.drpYTerm.SelectedIndex;
                                    selectedIndex4 = this.drpYDayRecur.SelectedIndex;
                                    selectedIndex5 = this.drpYMonthRecur.SelectedIndex;
                                }
                                else
                                {
                                    num18          = 0;
                                    selectedIndex2 = this.drpYMonth.SelectedIndex;
                                    num19          = Convert.ToInt32(this.txtYDay.Text.Trim().ToString());
                                }
                            }
                            reminderBO = new ReminderBO();
                            if ((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"] != null)
                            {
                                sZCASEID = ((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_CASE_ID;
                            }
                            if (this.Session["SZ_REMINDER_DOCTOR_ID"] != null)
                            {
                                str2 = this.Session["SZ_REMINDER_DOCTOR_ID"].ToString();
                            }
                            string value1       = "";
                            string sZCOMPANYID1 = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                            foreach (ListItem listItem in this.lsbAssignTo.Items)
                            {
                                if (!listItem.Selected)
                                {
                                    continue;
                                }
                                value1  = listItem.Value;
                                dataSet = reminderBO.SetReminderDetailsAdd(str, value1, str1, str3, dateTime2, dateTime1, num, num1, num2, num3, num4, num5, num6, num7, num8, num9, num10, num11, num12, num13, num14, num15, num16, selectedIndex, selectedIndex1, num17, num18, selectedIndex2, num19, selectedIndex3, selectedIndex4, selectedIndex5, str2, sZCASEID, sZCOMPANYID1, "CASE", this.extddlRType.Text, this.extddlRType.Selected_Text.ToString());
                            }
                        }
                        else
                        {
                            this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                            ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Reminder start date should not be greated than reminder end date...!!')", true);
                            return;
                        }
                    }
                    if (dataSet.Tables.Count <= 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ClearValues();alert('Failed to add reminder details..!!')", true);
                    }
                    else if (dataSet.Tables[0].Rows.Count <= 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ClearValues();alert('Failed to add reminder details..!!')", true);
                    }
                    else if (dataSet.Tables[0].Rows[0]["result"].ToString() == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ClearValues();alert('Reminder details added successfully...!!')", true);
                    }
                }
                else
                {
                    this.pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                    ScriptManager.RegisterClientScriptBlock(this.btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Plase select week days in weekly recurrence...!!')", true);
                    return;
                }
            }
            catch (Exception exception)
            {
            }
        }
        finally
        {
            reminderBO = null;
            dataSet    = null;
        }
    }
示例#2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ReminderBO objReminder     = null;
        DataSet    dsReminder      = null;
        string     str_description = "";
        string     str_assigned_to = "";
        string     str_assigned_by = "";
        string     str_case_id     = "";
        string     str_docotr_id   = "";
        DateTime   dt_start_date;
        DateTime   dt_end_date            = Convert.ToDateTime(System.DateTime.Now.AddYears(2).ToShortDateString());
        int        i_is_recurrence        = 0;
        int        i_recurrence_type      = 0;
        int        i_occurrence_end_count = 0;
        int        i_day_option           = 0;
        int        i_d_day_count          = 0;
        int        i_d_every_weekday      = 0;
        int        i_w_recur_week_count   = 0;
        int        i_w_sunday             = 0;
        int        i_w_monday             = 0;
        int        i_w_tuesday            = 0;
        int        i_w_wednesday          = 0;
        int        i_w_thursday           = 0;
        int        i_w_friday             = 0;
        int        i_w_saturday           = 0;
        int        i_month_option         = 0;
        int        i_m_day               = 0;
        int        i_m_month_count       = 0;
        int        i_m_term              = 100;
        int        i_m_term_week         = 100;
        int        i_m_every_month_count = 0;
        int        i_year_option         = 0;
        int        i_y_month             = 100;
        int        i_y_day               = 0;
        int        i_y_term              = 100;
        int        i_y_term_week         = 100;
        int        i_y_every_month_count = 100;
        string     strReminderStatus     = "RS000000000000000001";


        try
        {
            //_saveOperation.WebPage = this.Page;
            //_saveOperation.Xml_File = "AddReminderXML.xml";
            //_saveOperation.SaveMethod();
            //ClearControl();

            if (txtReminderDesc.Text.Trim().ToString() == "")
            {
                if (chkRecurrence.Checked == true)
                {
                    pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Note description should not be empty...!!')", true);
                    return;
                }
                else
                {
                    pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "none");
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Note description should not be empty...!!')", true);
                    return;
                }
            }

            if (txtStartDate.Text == "")
            {
                if (chkRecurrence.Checked == true)
                {
                    pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('start date should not be empty...!!')", true);
                    return;
                }
                else
                {
                    pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "none");
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('start date should not be empty...!!')", true);
                    return;
                }
            }



            if (rbtnWeekly.Checked == true)
            {
                if (chkWSunday.Checked == false && chkWMonday.Checked == false && chkWTuesday.Checked == false && chkWWednesday.Checked == false && chkWThursday.Checked == false && chkWFriday.Checked == false && chkWSaturday.Checked == false)
                {
                    pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Plase select week days in weekly recurrence...!!')", true);
                    return;
                }
            }

            str_description = txtReminderDesc.Text.Trim().ToString();

            str_description = str_description.Replace('\n', ' ');
            str_description = str_description.Replace('\r', ' ');

            if (txtUserID.Text != "")
            {
                str_assigned_by = txtUserID.Text.Trim().ToString();
            }
            dt_start_date = Convert.ToDateTime(txtStartDate.Text.Trim().ToString());

            str_assigned_to = lsbAssignTo.SelectedValue.ToString();

            if (chkRecurrence.Checked == true)
            {
                i_is_recurrence = 1;
                if (rbtnNoEndDate.Checked == true)
                {
                    dt_end_date = Convert.ToDateTime(System.DateTime.Now.AddYears(2).ToShortDateString());
                }
                else if (rbtnEndBy.Checked == true)
                {
                    dt_end_date = Convert.ToDateTime(txtEndByDate.Text.Trim().ToString());
                }
                else if (rbtnEndAfter.Checked == true)
                {
                    i_recurrence_type = 4;

                    i_occurrence_end_count = Convert.ToInt32(txtEndAfter.Text.Trim().ToString());
                    dt_end_date            = Convert.ToDateTime(txtStartDate.Text.Trim().ToString()).AddDays(Convert.ToDouble(i_occurrence_end_count));
                }

                if (dt_start_date.ToString() != "" && dt_end_date.ToString() != "")
                {
                    if (dt_start_date > dt_end_date)
                    {
                        pnlRecurrence.Style.Add(HtmlTextWriterStyle.Display, "block");
                        ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ReminderTypeBasedVisible();alert('Reminder start date should not be greated than reminder end date...!!')", true);
                        return;
                    }
                }

                if (rbtnDaily.Checked == true)
                {
                    i_recurrence_type = 0;

                    if (rbtnDEvery.Checked == true)
                    {
                        i_d_day_count = Convert.ToInt32(txtDDays.Text.Trim().ToString());
                        i_day_option  = 0;
                    }
                    else
                    {
                        i_d_every_weekday = 1;
                        i_day_option      = 1;
                    }
                }
                else if (rbtnWeekly.Checked == true)
                {
                    i_recurrence_type = 1;

                    i_w_recur_week_count = Convert.ToInt32(txtWRecur.Text.Trim().ToString());
                    if (chkWSunday.Checked == true)
                    {
                        i_w_sunday = 1;
                    }
                    if (chkWMonday.Checked == true)
                    {
                        i_w_monday = 1;
                    }
                    if (chkWTuesday.Checked == true)
                    {
                        i_w_tuesday = 1;
                    }
                    if (chkWWednesday.Checked == true)
                    {
                        i_w_wednesday = 1;
                    }
                    if (chkWThursday.Checked == true)
                    {
                        i_w_thursday = 1;
                    }
                    if (chkWFriday.Checked == true)
                    {
                        i_w_friday = 1;
                    }
                    if (chkWSaturday.Checked == true)
                    {
                        i_w_saturday = 1;
                    }
                }
                else if (rbtnMonthly.Checked == true)
                {
                    i_recurrence_type = 2;

                    if (rbtnMDay.Checked == true)
                    {
                        i_month_option  = 0;
                        i_m_day         = Convert.ToInt32(txtMDay.Text.Trim().ToString());
                        i_m_month_count = Convert.ToInt32(txtMMonths.Text.Trim().ToString());
                    }
                    else
                    {
                        i_month_option        = 1;
                        i_m_term              = drpMTerm.SelectedIndex;
                        i_m_term_week         = drpMDayRecur.SelectedIndex;
                        i_m_every_month_count = Convert.ToInt32(txtMEveryMonths.Text.Trim().ToString());
                    }
                }
                else if (rbtnYearly.Checked == true)
                {
                    i_recurrence_type = 3;

                    if (rbtnYEvery.Checked == true)
                    {
                        i_year_option = 0;
                        i_y_month     = drpYMonth.SelectedIndex;
                        i_y_day       = Convert.ToInt32(txtYDay.Text.Trim().ToString());
                    }
                    else
                    {
                        i_year_option         = 1;
                        i_y_term              = drpYTerm.SelectedIndex;
                        i_y_term_week         = drpYDayRecur.SelectedIndex;
                        i_y_every_month_count = drpYMonthRecur.SelectedIndex;
                    }
                }



                objReminder = new ReminderBO();
                if (((Bill_Sys_CaseObject)Session["CASE_OBJECT"]) != null)
                {
                    str_case_id = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
                }
                if (Session["SZ_REMINDER_DOCTOR_ID"] != null)
                {
                    str_docotr_id = Session["SZ_REMINDER_DOCTOR_ID"].ToString();
                }
                string Assign_To     = "";
                string strCompany_id = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;


                foreach (ListItem listitem in lsbAssignTo.Items)
                {
                    if (listitem.Selected)
                    {
                        Assign_To  = listitem.Value;
                        dsReminder = objReminder.SetReminderDetailsAdd(str_description, Assign_To, str_assigned_by, strReminderStatus, dt_start_date, dt_end_date, i_is_recurrence, i_recurrence_type, i_occurrence_end_count, i_day_option, i_d_day_count, i_d_every_weekday, i_w_recur_week_count, i_w_sunday, i_w_monday, i_w_tuesday, i_w_wednesday, i_w_thursday, i_w_friday, i_w_saturday, i_month_option, i_m_day, i_m_month_count, i_m_term, i_m_term_week, i_m_every_month_count, i_year_option, i_y_month, i_y_day, i_y_term, i_y_term_week, i_y_every_month_count, str_docotr_id, str_case_id, strCompany_id, "LOGIN", extddlRType.Text, extddlRType.Selected_Text.ToString());
                    }
                }
            }
            else
            {
                i_occurrence_end_count = 1;
                dt_end_date            = Convert.ToDateTime(txtStartDate.Text.Trim().ToString());

                objReminder = new ReminderBO();
                if (((Bill_Sys_CaseObject)Session["CASE_OBJECT"]) != null)
                {
                    str_case_id = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
                }

                if (Session["SZ_REMINDER_DOCTOR_ID"] != null)
                {
                    str_docotr_id = Session["SZ_REMINDER_DOCTOR_ID"].ToString();
                }
                string AssignTo     = "";
                string strCompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;

                foreach (ListItem listitem in lsbAssignTo.Items)
                {
                    if (listitem.Selected)
                    {
                        AssignTo   = listitem.Value;
                        dsReminder = objReminder.SetReminderDetailsAdd(str_description, AssignTo, str_assigned_by, strReminderStatus, dt_start_date, dt_end_date, i_is_recurrence, i_recurrence_type, i_occurrence_end_count, i_day_option, i_d_day_count, i_d_every_weekday, i_w_recur_week_count, i_w_sunday, i_w_monday, i_w_tuesday, i_w_wednesday, i_w_thursday, i_w_friday, i_w_saturday, i_month_option, i_m_day, i_m_month_count, i_m_term, i_m_term_week, i_m_every_month_count, i_year_option, i_y_month, i_y_day, i_y_term, i_y_term_week, i_y_every_month_count, str_docotr_id, str_case_id, strCompanyID, "LOGIN", extddlRType.Text, extddlRType.Selected_Text.ToString());
                    }
                }
            }
            if (dsReminder.Tables.Count > 0)
            {
                if (dsReminder.Tables[0].Rows.Count > 0)
                {
                    if (dsReminder.Tables[0].Rows[0]["result"].ToString() == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ClearValues();alert('Reminder details added successfully...!!')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ClearValues();alert('Failed to add reminder details..!!')", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(btnSave, typeof(Button), "Msg", "ClearValues();alert('Failed to add reminder details..!!')", true);
            }
        }
        catch (Exception ex)
        {
        }
        finally
        {
            objReminder = null;
            dsReminder  = null;
        }
    }