protected void btdelete_Click(object sender, EventArgs e)
    {//Logging Start
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            ArrayList arrtransport = new ArrayList();
            for (int i = 0; i < grdTransport.Items.Count; i++)
            {
                CheckBox chktransport = (CheckBox)grdTransport.Items[i].FindControl("chkDelete");
                if (chktransport.Checked == true)
                {
                    string strtransportid = grdTransport.DataKeys[i].ToString();
                    arrtransport.Add(strtransportid);
                }
            }
            BillSearchDAO _objBillSearchDAO = new BillSearchDAO();
            _objBillSearchDAO.Delete_Trans_Data(arrtransport, txtCompanyID.Text);


            MessageControl1.PutMessage("Delete Successfully ...!");
            MessageControl1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            MessageControl1.Show();

            DataSet ds = new DataSet();
            ds = _objBillSearchDAO.getTransportinfo(txtCaseID.Text, txtCompanyID.Text);
            grdTransport.DataSource = ds;
            grdTransport.DataBind();
            ClearControl_Popup();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    protected void btnsave_Click(object sender, EventArgs e)
    {//Logging Start
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        BillSearchDAO _BillSearchDAO = new BillSearchDAO();

        try
        {
            _BillSearchDAO.GetInsertTransport(extddlTransport.Selected_Text, extddlTransport.Text, txtCompanyID.Text, txtCaseID.Text, txtFromDate.Text, ddlHours.SelectedItem.ToString(), ddlMinutes.SelectedItem.ToString(), ddlTime.SelectedItem.ToString());
            MessageControl1.PutMessage("Save Successfully ...!");
            MessageControl1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            MessageControl1.Show();
            ClearControl_Popup();

            DataSet ds = new DataSet();
            ds = _BillSearchDAO.getTransportinfo(txtCaseID.Text, txtCompanyID.Text);
            grdTransport.DataSource = ds;
            grdTransport.DataBind();
        }
        catch (Exception ex)
        {
            this.Session["SendPatientToDoctor"] = false;
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            DAO_Assign_Doc DAO     = new DAO_Assign_Doc();
            ArrayList      lstDoc  = new ArrayList();
            ArrayList      lstDoc1 = new ArrayList();
            lstDoc = (ArrayList)Session["SelectedDocList"];
            lbAllSelectedDocuments.Items.Clear();
            int order = 0;

            string[] arrSpeciality = new string[1000];
            string[] arrNode       = new string[1000];
            int      count         = 0;

            ArrayList lstRemoved = (ArrayList)Session["RemovedDoc"];
            for (int i = 0; i < lstRemoved.Count; i++)
            {
                DAO_Assign_Doc dao = new DAO_Assign_Doc();
                dao = (DAO_Assign_Doc)lstRemoved[i];
                objBillSysDocBO.RemoveSpecialityDoc(dao.SelectedSpecialityID, txtCompanyID.Text, dao.SelectedId);
            }
            lstRemoved.Clear();
            for (int i = 0; i < lstDoc.Count; i++)
            {
                int iflag = 0;
                DAO = (DAO_Assign_Doc)lstDoc[i];
                string[] selectedNode = new string[500];
                selectedNode = hfselectedNodeinListbox.Value.Split(',');
                for (int j = 0; j < selectedNode.Length - 1; j++)
                {
                    if (!selectedNode[j].Equals("") && selectedNode[j].Split('~')[1].Equals(DAO.SelectedId) && selectedNode[j].Split('~')[0].Equals(DAO.SelectedSpecialityID))
                    {
                        objBillSysDocBO.AssignDocToSpeciality(selectedNode[j].Split('~')[1], ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, DAO.SelectedSpecialityID, txtCompanyID.Text, DAO.ORDER, true);
                        iflag = 1;
                        DAO.REQUIRED_MULTIPLE = true;
                        arrSpeciality[i]      = DAO.SelectedSpecialityID;
                        arrNode[i]            = selectedNode[j].Split('~')[1];
                        count++;
                    }
                    order = DAO.ORDER;
                }
                if (iflag == 0)
                {
                    objBillSysDocBO.AssignDocToSpeciality(DAO.SelectedId, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, DAO.SelectedSpecialityID, txtCompanyID.Text, DAO.ORDER, false);
                    DAO.REQUIRED_MULTIPLE = false;
                    arrSpeciality[i]      = DAO.SelectedSpecialityID;
                    arrNode[i]            = DAO.SelectedId;
                    count++;
                }
                lstDoc1.Add(DAO);
            }
            DataSet ds = new DataSet();

            //ds = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, arrSpeciality[0]);
            //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            //{

            //    int flag = 0;
            //    for (int j = 0; j < count; j++)
            //    {
            //        if ((Convert.ToInt32(ds.Tables[0].Rows[i][0]) == Convert.ToInt32(arrNode[j])) && ds.Tables[0].Rows[i][1].Equals(arrSpeciality[j]))
            //        {
            //            flag = 1;
            //        }
            //    }
            //    if (flag == 0)
            //    {
            //        if (arrSpeciality[i] == null)
            //        {
            //            break;
            //        }
            //        else
            //        {
            //            objBillSysDocBO.RemoveSpecialityDoc(arrSpeciality[i], txtCompanyID.Text, arrNode[i]);
            //        }
            //    }
            //    ds = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, arrSpeciality[i]);
            //}
            Session["SelectedDocList"] = lstDoc1;
            //lblmsg.Text = "Documents Saved Successfully!";

            lstDoc = (ArrayList)Session["SelectedDocList"];
            lbAllSelectedDocuments.Items.Clear();
            lbselect.Items.Clear();
            if (lstDoc != null)
            {
                hfselectedNodeinListbox.Value = "";
                for (int i = 0; i < lstDoc.Count; i++)
                {
                    DAO = (DAO_Assign_Doc)lstDoc[i];
                    if (DAO.REQUIRED_MULTIPLE)
                    {
                        ListItem lst = new ListItem();
                        lst.Text  = DAO.SelectedSpeciality + DAO.SelectedText;
                        lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId;
                        hfselectedNodeinListbox.Value = hfselectedNodeinListbox.Value + lst.Value + ",";
                        lbselect.Items.Add(lst);
                    }
                    else
                    {
                        ListItem lst = new ListItem();
                        lst.Text  = DAO.SelectedSpeciality + DAO.SelectedText;
                        lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId;
                        lbAllSelectedDocuments.Items.Add(lst);
                    }
                }
            }
            ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text);
            lstDoc.Clear();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DAO_Assign_Doc DAONew = new DAO_Assign_Doc();
                DAONew.SelectedId           = ds.Tables[0].Rows[i][0].ToString();
                DAONew.SelectedText         = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString());
                DAONew.SelectedSpeciality   = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString());
                DAONew.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString();
                DAONew.ORDER             = Convert.ToInt32(ds.Tables[0].Rows[i][2]);
                DAONew.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]);
                lstDoc.Add(DAONew);
            }

            Session["SelectedDocList"] = lstDoc;
            lstRemoved.Clear();
            Session["RemovedDoc"] = lstRemoved;
            MessageControl1.PutMessage("Documents Saved Successfully!");
            MessageControl1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            MessageControl1.Show();
            //Session["SelectedDocList"] = null;
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }