protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        DAO_Assign_Doc DAO    = new DAO_Assign_Doc();
        ArrayList      lstDoc = new ArrayList();

        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);
                }
            }
        }
    }
Example #2
0
        public bool AssignOutScheduleDocumentsToTestFacility(ArrayList objAl, string sz_user_Id, string sz_company_id, string testFacilityCompanyID)
        {
            conn = new SqlConnection(strsqlCon);
            conn.Open();
            SqlTransaction transaction;

            transaction = conn.BeginTransaction();


            try
            {
                #region Clear already confired documents to test facility
                comm = new SqlCommand();
                comm.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                comm.CommandText    = "sp_clear_assigned_doc_to_test_facilty";
                comm.CommandType    = CommandType.StoredProcedure;
                comm.Connection     = conn;
                comm.Transaction    = transaction;
                comm.Parameters.AddWithValue("@sz_company_id", sz_company_id);
                comm.Parameters.AddWithValue("@sz_test_facilty", testFacilityCompanyID);
                comm.ExecuteNonQuery();
                #endregion

                #region configure new assigned documents to test facility
                for (int i = 0; i < objAl.Count; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO = (DAO_Assign_Doc)objAl[i];


                    comm = new SqlCommand();
                    comm.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                    comm.CommandText    = "sp_assign_out_schedule_docs_to_test_facility";
                    comm.CommandType    = CommandType.StoredProcedure;
                    comm.Connection     = conn;
                    comm.Transaction    = transaction;
                    comm.Parameters.AddWithValue("@SZ_COMPANY_ID", sz_company_id);
                    comm.Parameters.AddWithValue("@I_NODE_ID", Convert.ToInt32(DAO.SelectedId));
                    comm.Parameters.AddWithValue("@SZ_USERID", sz_user_Id);
                    comm.Parameters.AddWithValue("@SZ_TEST_FACILITY_COMPANY_ID", DAO.SelectedRoleID);
                    comm.ExecuteNonQuery();
                }
                #endregion
                transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                transaction.Rollback();
                return(false);
            }
            finally { conn.Close(); }
        }
Example #3
0
    protected void btnAssign_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
        {
            //if (ddUserRole.SelectedValue.Equals("0"))
            //{
            //}
            if (extddlReferringFacility.Selected_Text.Equals("--- Select ---"))
            {
                usrMessage.PutMessage("Select a facility from the dropdown to proceed.");
                usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage);
                usrMessage.Show();
            }
            else
            {
                ArrayList lstDoc    = new ArrayList();
                string[]  Documents = new string[100];
                lbSelectedDocs.Items.Clear();
                Documents = hfselectedNode.Value.Split(',');
                for (int i = 0; i < Documents.Length - 1; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO.SelectedText = Documents[i].Split('-')[0];
                    if (DAO.SelectedText == ">>No Fault File>>Medicals>>CT")
                    {
                        DAO.SelectedId = Documents[i].Split('-')[2];
                    }
                    else
                    {
                        DAO.SelectedId = Documents[i].Split('-')[1];
                    }
                    //DAO.SelectedRole = ddUserRole.SelectedItem.Text;
                    DAO.SelectedRole = extddlReferringFacility.Selected_Text;
                    //DAO.SelectedRoleID = ddUserRole.SelectedItem.Value;
                    DAO.SelectedRoleID = extddlReferringFacility.Text;
                    lstDoc.Add(DAO);
                }
                ArrayList Objal1 = new ArrayList();
                ArrayList Objal2 = new ArrayList();
                for (int i = 0; i < lstDoc.Count; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO = (DAO_Assign_Doc)lstDoc[i];
                    Objal1.Add(DAO);
                    ListItem lst = new ListItem();
                    lst.Text  = DAO.SelectedText.ToString();
                    lst.Value = DAO.SelectedId.ToString();
                    lbSelectedDocs.Items.Add(lst);
                }
                OutSchedulePatient objOutTran = new OutSchedulePatient();
                objOutTran.AssignOutScheduleDocumentsToTestFacility(Objal1, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, txtCompanyID.Text, extddlReferringFacility.Text);



                //for (int i = 0; i < lstDoc.Count; i++)
                //{
                //    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                //    DAO = (DAO_Assign_Doc)lstDoc[i];
                //    //objBillSysDocBO.AssignDocumentsToUserRole(DAO.SelectedId, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, txtCompanyID.Text, DAO.SelectedRoleID);
                // objBillSysDocBO.AssignOutScheduleDocumentsToTestFacility(DAO.SelectedId, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, txtCompanyID.Text, DAO.SelectedRoleID);
                //    ListItem lst = new ListItem();
                //    lst.Text = DAO.SelectedText.ToString();
                //    lst.Value = DAO.SelectedId.ToString();
                //    lbSelectedDocs.Items.Add(lst);
                //}
                //dsDocuments = objBillSysDocBO.GetDocumentsAssignedToUserRole(txtCompanyID.Text, ddUserRole.SelectedValue);
                dsDocuments = objBillSysDocBO.GetDocumentsAssignedToTestFacility(txtCompanyID.Text, extddlReferringFacility.Text);
                //for (int i = 0; i < dsDocuments.Tables[0].Rows.Count; i++)
                //{
                //    int flag = 0;
                //    for (int j = 0; j < lstDoc.Count; j++)
                //    {
                //        DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                //        DAO = (DAO_Assign_Doc)lstDoc[j];

                //        if (dsDocuments.Tables[0].Rows[i][1].ToString().Equals(DAO.SelectedId))
                //        {
                //            flag = 1;
                //        }
                //    }
                //    if (flag == 1)
                //    {

                //    }
                //    else
                //    {
                //        //objBillSysDocBO.RemoveUserRoleDoc(ddUserRole.SelectedValue, txtCompanyID.Text, dsDocuments.Tables[0].Rows[i][1].ToString());
                //        objBillSysDocBO.RemoveUserRoleDoc(extddlReferringFacility.Text, txtCompanyID.Text, dsDocuments.Tables[0].Rows[i][1].ToString());
                //    }
                //}
                usrMessage.PutMessage("Transfer documents configured between your account and selected facility.");
                usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                usrMessage.Show();
            }
        }
        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 btnAssign_Click(object sender, EventArgs 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());
        }
        ArrayList lstDoc = new ArrayList();

        string[] Documents = new string[100];
        lbSelectedDocs.Items.Clear();
        Documents = hfselectedNode.Value.Split(',');
        objarrlst = (ArrayList)Session["Document_List"];
        try
        {
            for (int i = 0; i < Documents.Length - 1; i++)
            {
                Bil_Sys_Missing_Document objMissDoc = new Bil_Sys_Missing_Document();
                DAO_Assign_Doc           DAO        = new DAO_Assign_Doc();
                DAO.SelectedText = Documents[i].Split('~')[0];
                DAO.SelectedId   = Documents[i].Split('~')[1];
                lstDoc.Add(DAO);
            }
            for (int i = 0; i < lstDoc.Count; i++)
            {
                DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                DAO = (DAO_Assign_Doc)lstDoc[i];
                objBillSysDocBO.SaveMissingDocument(DAO.SelectedId, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, txtCompanyID.Text);
                ListItem lst = new ListItem();
                lst.Text  = DAO.SelectedText.ToString();
                lst.Value = DAO.SelectedId.ToString();
                lbSelectedDocs.Items.Add(lst);
            }
            dsDocuments = objBillSysDocBO.GetMissingDocumentsCompanyWise(txtCompanyID.Text);
            for (int i = 0; i < dsDocuments.Tables[0].Rows.Count; i++)
            {
                int flag = 0;
                for (int j = 0; j < lstDoc.Count; j++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO = (DAO_Assign_Doc)lstDoc[j];

                    if (dsDocuments.Tables[0].Rows[i][1].ToString().Equals(DAO.SelectedId))
                    {
                        flag = 1;
                    }
                }
                if (flag == 1)
                {
                }
                else
                {
                    objBillSysDocBO.RemoveMissingDoc(txtCompanyID.Text, dsDocuments.Tables[0].Rows[i][1].ToString(), ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID);
                }
                usrMessage.PutMessage("Documents Saved Successfully...");
                usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                usrMessage.Show();
            }
        }
        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());
        }
    }
Example #5
0
    protected void btnAssign_Click(object sender, EventArgs 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
        {
            if (!this.ddUserRole.SelectedValue.Equals("0"))
            {
                ArrayList arrayLists = new ArrayList();
                string[]  strArrays  = new string[100];
                this.lbSelectedDocs.Items.Clear();
                strArrays = this.hfselectedNode.Value.Split(new char[] { ',' });
                for (int i = 0; i < (int)strArrays.Length - 1; i++)
                {
                    DAO_Assign_Doc dAOAssignDoc = new DAO_Assign_Doc();
                    string         str          = strArrays[i];
                    char[]         chrArray     = new char[] { '~' };
                    dAOAssignDoc.SelectedText = str.Split(chrArray)[0];
                    string str1      = strArrays[i];
                    char[] chrArray1 = new char[] { '~' };
                    dAOAssignDoc.SelectedId     = str1.Split(chrArray1)[1];
                    dAOAssignDoc.SelectedRole   = this.ddUserRole.SelectedItem.Text;
                    dAOAssignDoc.SelectedRoleID = this.ddUserRole.SelectedItem.Value;
                    arrayLists.Add(dAOAssignDoc);
                }
                for (int j = 0; j < arrayLists.Count; j++)
                {
                    DAO_Assign_Doc item = new DAO_Assign_Doc();
                    item = (DAO_Assign_Doc)arrayLists[j];
                    this.objBillSysDocBO.AssignDocumentsToUserRole(item.SelectedId, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID, this.txtCompanyID.Text, item.SelectedRoleID);
                    ListItem listItem = new ListItem()
                    {
                        Text  = item.SelectedText.ToString(),
                        Value = item.SelectedId.ToString()
                    };
                    this.lbSelectedDocs.Items.Add(listItem);
                }
                this.dsDocuments = this.objBillSysDocBO.GetDocumentsAssignedToUserRole(this.txtCompanyID.Text, this.ddUserRole.SelectedValue);
                for (int k = 0; k < this.dsDocuments.Tables[0].Rows.Count; k++)
                {
                    int num = 0;
                    for (int l = 0; l < arrayLists.Count; l++)
                    {
                        DAO_Assign_Doc dAOAssignDoc1 = new DAO_Assign_Doc();
                        dAOAssignDoc1 = (DAO_Assign_Doc)arrayLists[l];
                        if (this.dsDocuments.Tables[0].Rows[k][1].ToString().Equals(dAOAssignDoc1.SelectedId))
                        {
                            num = 1;
                        }
                    }
                    if (num != 1)
                    {
                        this.objBillSysDocBO.RemoveUserRoleDoc(this.ddUserRole.SelectedValue, this.txtCompanyID.Text, this.dsDocuments.Tables[0].Rows[k][1].ToString());
                    }
                }
                this.usrMessage.PutMessage("Documents Assigned Successfully!");
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                this.usrMessage.Show();
            }
            else
            {
                this.usrMessage.PutMessage("User role is not selected.");
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage);
                this.usrMessage.Show();
            }
        }
        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 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());
        }
    }
    protected void btnAssign_Click(object sender, EventArgs 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
        {
            if (ddlSpeciality.SelectedValue.Equals("0"))
            {
                usrMessage.PutMessage("Speciality is not selected.");
                usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage);
                usrMessage.Show();
            }
            else
            {
                ArrayList lstDoc = (ArrayList)Session["SelectedDocList"];
                if (lstDoc == null)
                {
                    lstDoc = new ArrayList();
                }
                string[] Documents = new string[100];
                Documents = hfselectedNode.Value.Split(',');
                lbSelectedDocs.Items.Clear();
                ArrayList lstRemoved = new ArrayList();
                for (int i = 0; i < Documents.Length - 1; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO.SelectedText         = Documents[i].Split('~')[0];
                    DAO.SelectedId           = Documents[i].Split('~')[2];
                    DAO.SelectedSpeciality   = ddlSpeciality.SelectedItem.Text;
                    DAO.SelectedSpecialityID = ddlSpeciality.SelectedItem.Value;
                    DAO.ORDER = i;
                    for (int j = 0; j < lstDoc.Count; j++)
                    {
                        DAO_Assign_Doc DAO1 = new DAO_Assign_Doc();
                        DAO1 = (DAO_Assign_Doc)lstDoc[j];
                        if (DAO1.SelectedSpecialityID.Equals(DAO.SelectedSpecialityID))
                        {
                            lstDoc.Remove(DAO1);
                            lstRemoved.Add(DAO1);
                            j--;
                        }
                    }
                }
                if (Documents.Length - 1 == 0)
                {
                    for (int j = 0; j < lstDoc.Count; j++)
                    {
                        DAO_Assign_Doc DAO1 = new DAO_Assign_Doc();
                        DAO1 = (DAO_Assign_Doc)lstDoc[j];
                        if (ddlSpeciality.SelectedValue.Equals(DAO1.SelectedSpecialityID))
                        {
                            lstDoc.Remove(DAO1);
                            lstRemoved.Add(DAO1);
                            j--;
                        }
                    }
                }

                for (int i = 0; i < Documents.Length - 1; i++)
                {
                    ListItem list = new ListItem();
                    list.Text  = "";
                    list.Value = "";
                    if (!Documents[i].Split('~')[0].Equals(""))
                    {
                        lbSelectedDocs.Items.Add(list);
                    }
                }
                hfselectedNode.Value = "";

                ArrayList lstDoc1 = new ArrayList();
                DataSet   ds      = new DataSet();
                ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO.SelectedId           = ds.Tables[0].Rows[i][0].ToString();
                    DAO.SelectedText         = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString());
                    DAO.SelectedSpeciality   = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString());
                    DAO.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString();
                    DAO.ORDER             = Convert.ToInt32(ds.Tables[0].Rows[i][2]);
                    DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]);
                    lstDoc1.Add(DAO);
                }

                for (int i = 0; i < Documents.Length - 1; i++)
                {
                    ListItem list = new ListItem();
                    if (!Documents[i].Split('~')[0].Equals(""))
                    {
                        list.Text  = Documents[i].Split('~')[0];
                        list.Value = Documents[i].Split('~')[1] + "~" + Documents[i].Split('~')[2];
                        lbSelectedDocs.Items.Insert(i, list);
                        lbSelectedDocs.Items.RemoveAt(i + 1);
                        DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                        DAO.SelectedText         = Documents[i].Split('~')[0];
                        DAO.SelectedId           = Documents[i].Split('~')[2];
                        DAO.SelectedSpeciality   = ddlSpeciality.SelectedItem.Text;
                        DAO.SelectedSpecialityID = ddlSpeciality.SelectedItem.Value;
                        DAO.ORDER = i;
                        int flag = 0;
                        for (int j = 0; j < lstDoc1.Count; j++)
                        {
                            DAO_Assign_Doc DAO1 = new DAO_Assign_Doc();
                            DAO1 = (DAO_Assign_Doc)lstDoc1[j];
                            if (DAO.SelectedSpecialityID.Equals(DAO1.SelectedSpecialityID) && DAO.SelectedId.Equals(DAO1.SelectedId))
                            {
                                DAO.REQUIRED_MULTIPLE = DAO1.REQUIRED_MULTIPLE;
                                flag = 1;
                                int ins = 0;
                                for (int k = 0; k < lstDoc.Count; k++)
                                {
                                    DAO_Assign_Doc DAODocInSession = new DAO_Assign_Doc();
                                    DAODocInSession = (DAO_Assign_Doc)lstDoc[k];
                                    if (DAO.SelectedSpecialityID.Equals(DAODocInSession.SelectedSpecialityID) && DAO.SelectedId.Equals(DAODocInSession.SelectedId))
                                    {
                                        ins = 1;
                                    }
                                    else
                                    {
                                        ins = 0;
                                    }
                                }
                                if (ins == 0)
                                {
                                    lstDoc.Add(DAO);
                                    lstRemoved.Remove(DAO);
                                    hfselectedNode.Value = hfselectedNode.Value + list.Text + "~" + list.Value + ",";
                                }
                                break;
                            }
                        }
                        if (flag == 0)
                        {
                            lstDoc.Add(DAO);
                            hfselectedNode.Value = hfselectedNode.Value + list.Text + "~" + list.Value + ",";
                        }
                    }
                }
                Session["SelectedDocList"] = lstDoc;
                Session["RemovedDoc"]      = lstRemoved;
                usrMessage.PutMessage("Documents Assigned Successfully!");
                usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                usrMessage.Show();
                //Label3.Text = "Documents Assigned Successfully!";
            }
        }
        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());
        }
    }
    void FillChildMenu(TreeNode node)
    {
        string  MenuID         = node.Value;
        DataSet ChildMenuTable = new DataSet();

        ChildMenuTable = objBillSysDocBO.GetChildNodes(Convert.ToInt32(MenuID), txtCompanyID.Text);

        dsSpecialityDoc = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, ddlSpeciality.SelectedValue);
        if (ChildMenuTable.Tables.Count > 0)
        {
            foreach (DataRow row in ChildMenuTable.Tables[0].Rows)
            {
                TreeNode newNode = new TreeNode(row["SZ_NODE_NAME"].ToString(), row["I_NODE_ID"].ToString());
                newNode.PopulateOnDemand = false;
                newNode.SelectAction     = TreeNodeSelectAction.Expand;
                newNode.ShowCheckBox     = true;
                string str = "";
                newNode.ToolTip = node.ToolTip + ">>" + row["SZ_NODE_NAME"].ToString() + "(" + row["I_NODE_ID"].ToString() + ")";
                newNode.Value   = row["I_NODE_ID"].ToString();
                for (int i = 0; i < dsSpecialityDoc.Tables[0].Rows.Count; i++)
                {
                    if (row["I_NODE_ID"].ToString().Equals(dsSpecialityDoc.Tables[0].Rows[i][0].ToString()))
                    {
                        newNode.Checked = true;
                        string   path   = node.ToolTip;
                        string[] nodeid = new string[10];
                        nodeid = node.ValuePath.Split('/');
                        for (int j = 0; j < nodeid.Length; j++)
                        {
                            path = path.Replace("(" + nodeid[j] + ")", "");
                        }
                        hfselectedNode.Value = hfselectedNode.Value + path + ">>" + row["SZ_NODE_NAME"].ToString() + "~" + dsSpecialityDoc.Tables[0].Rows[i][1].ToString() + "~" + row["I_NODE_ID"].ToString() + ",";
                        ListItem list1 = new ListItem();
                        list1.Text  = path + ">>" + row["SZ_NODE_NAME"].ToString();
                        list1.Value = dsSpecialityDoc.Tables[0].Rows[i][1].ToString() + "~" + row["I_NODE_ID"].ToString();
                        lbSelectedDocs.Items.Insert(Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]), list1);
                        lbSelectedDocs.Items.RemoveAt(Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]) + 1);
                        hfOrder.Value = hfOrder.Value + row["I_NODE_ID"].ToString() + "~" + dsSpecialityDoc.Tables[0].Rows[i][2].ToString() + ",";
                        DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                        DAO.SelectedId           = row["I_NODE_ID"].ToString();
                        DAO.SelectedText         = path + ">>" + row["SZ_NODE_NAME"].ToString();
                        DAO.SelectedSpeciality   = ddlSpeciality.SelectedItem.Text;
                        DAO.SelectedSpecialityID = dsSpecialityDoc.Tables[0].Rows[i][1].ToString();
                        DAO.ORDER             = Convert.ToInt32(dsSpecialityDoc.Tables[0].Rows[i][2]);
                        DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(dsSpecialityDoc.Tables[0].Rows[i][3]);
                        ArrayList lstDoc = new ArrayList();

                        if (Session["SelectedDocList"] == null)
                        {
                            lstDoc.Add(DAO);
                            Session["SelectedDocList"] = lstDoc;
                        }
                        else
                        {
                            lstDoc = (ArrayList)Session["SelectedDocList"];
                            Session["SelectedDocList"] = lstDoc;
                            int flag = 0;
                            for (int l = 0; l < lstDoc.Count; l++)
                            {
                                DAO_Assign_Doc DAO1 = new DAO_Assign_Doc();
                                DAO1 = (DAO_Assign_Doc)lstDoc[l];
                                if (DAO1.SelectedId.Equals(DAO.SelectedId) && DAO1.SelectedSpecialityID.Equals(DAO.SelectedSpecialityID))
                                {
                                    flag = 1;
                                    break;
                                }
                            }
                            if (flag == 0)
                            {
                                lstDoc.Add(DAO);
                            }
                        }
                        if (Session["SelectedDocList"] != null)
                        {
                            ArrayList lstDoc1 = new ArrayList();
                            lstDoc1 = (ArrayList)Session["SelectedDocList"];
                            for (int k = 0; k < lstDoc1.Count; k++)
                            {
                                DAO_Assign_Doc dao = new DAO_Assign_Doc();
                                dao = (DAO_Assign_Doc)lstDoc[k];
                                if (dao.SelectedId.Equals(row["I_NODE_ID"].ToString()) && dao.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue.ToString()))
                                {
                                    newNode.Checked = true;
                                }
                            }
                        }
                    }
                    else if (Session["SelectedDocList"] != null)
                    {
                        ArrayList lstDoc = new ArrayList();
                        lstDoc = (ArrayList)Session["SelectedDocList"];
                        for (int k = 0; k < lstDoc.Count; k++)
                        {
                            DAO_Assign_Doc dao = new DAO_Assign_Doc();
                            dao = (DAO_Assign_Doc)lstDoc[k];
                            if (dao.SelectedId.Equals(row["I_NODE_ID"].ToString()) && dao.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue.ToString()))
                            {
                                newNode.Checked = true;
                            }
                        }
                    }
                }
                node.ChildNodes.Add(newNode);
                FillChildMenu(newNode);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs 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
        {
            tvwmenu.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
            btnAssign.Attributes.Add("onclick", "order()");
            txtCompanyID.Text = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            if (!IsPostBack)
            {
                txtUserID.Text = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;

                //load speciality in the dropdownlist.
                DataSet  dsSpeciality = objSpeciality.GetSpecialityList(txtCompanyID.Text);
                ListItem list2        = new ListItem();
                list2.Text  = "---Select---";
                list2.Value = "0";
                ddlSpeciality.Items.Add(list2);
                for (int i = 0; i < dsSpeciality.Tables[0].Rows.Count; i++)
                {
                    ListItem list = new ListItem();
                    list.Text  = dsSpeciality.Tables[0].Rows[i][1].ToString();
                    list.Value = dsSpeciality.Tables[0].Rows[i][0].ToString();
                    ddlSpeciality.Items.Add(list);
                }
                hfselectedNodeinListbox.Value = "";

                //Load All the documents in the session, which are available in the database.
                DataSet ds = new DataSet();
                ds = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text);
                ArrayList lstDoc = new ArrayList();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                    DAO.SelectedId           = ds.Tables[0].Rows[i][0].ToString();
                    DAO.SelectedText         = objBillSysDocBO.GetFullPathOfNode(ds.Tables[0].Rows[i][0].ToString());
                    DAO.SelectedSpeciality   = objBillSysDocBO.GetSpecialityNameUsingId(ds.Tables[0].Rows[i][1].ToString());
                    DAO.SelectedSpecialityID = ds.Tables[0].Rows[i][1].ToString();
                    DAO.ORDER             = Convert.ToInt32(ds.Tables[0].Rows[i][2]);
                    DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(ds.Tables[0].Rows[i][3]);
                    lstDoc.Add(DAO);
                }
                Session["SelectedDocList"] = lstDoc;
            }

            //load Listbox on the Step 1 of the wizard. if selected speciality is not '---Select---'
            if (!ddlSpeciality.SelectedValue.Equals("0"))
            {
                tvwmenu.Visible = true;
                DAO_Assign_Doc DAO    = new DAO_Assign_Doc();
                ArrayList      lstDoc = new ArrayList();
                lstDoc = (ArrayList)Session["SelectedDocList"];
                lbSelectedDocs.Items.Clear();
                if (lstDoc != null)
                {
                    for (int i = 0; i < lstDoc.Count; i++)
                    {
                        DAO = (DAO_Assign_Doc)lstDoc[i];
                        ListItem lst = new ListItem();
                        lst.Text  = DAO.SelectedText;
                        lst.Value = DAO.SelectedSpecialityID + "~" + DAO.SelectedId;
                        if (DAO.SelectedSpecialityID.Equals(ddlSpeciality.SelectedValue))
                        {
                            lbSelectedDocs.Items.Add(lst);
                        }
                    }
                }
            }
            else
            {
                //load treeview
                tvwmenu.Visible = true;
                tvwmenu.ExpandAll();
                tvwmenu.ShowExpandCollapse = true;
            }
            // Label3.Text = "";
            //lblmsg.Text = "";

            //load treeview and listbox on the step 1 of the wizard if user clicks on 'Previous' button on the step 2 of the wizard.
            if (Wizard1.ActiveStepIndex == 1)
            {
                if (Session["SelectedDocList"] != null)
                {
                    hfselectedNode.Value = "";
                    dsSpecialityDoc      = objBillSysDocBO.GetSecialityDoc(txtCompanyID.Text, ddlSpeciality.SelectedValue);
                    for (int i = 0; i < dsSpecialityDoc.Tables[0].Rows.Count; i++)
                    {
                        ListItem list = new ListItem();
                        list.Text  = "";
                        list.Value = "";
                        lbSelectedDocs.Items.Add(list);
                    }
                    //tvwmenu.PopulateNodesFromClient = true;
                    //tvwmenu.Nodes.RemoveAt(0);
                    //TreeNode node = new TreeNode("Document Manager", "0");
                    //node.PopulateOnDemand = true;
                    //tvwmenu.Nodes.Add(node);
                    //tvwmenu.ExpandAll();
                    int count = lbSelectedDocs.Items.Count;
                    for (int i = 0; i < count; i++)
                    {
                        if (lbSelectedDocs.Items[i].Value.Equals(""))
                        {
                            lbSelectedDocs.Items.RemoveAt(i);
                            i--;
                            count--;
                        }
                        else
                        {
                        }
                    }
                }
            }
            DataSet dsDoc = new DataSet();
            dsDoc = objBillSysDocBO.GetAllSecialityDoc(txtCompanyID.Text);
            lbAllAssignedDoc.Items.Clear();
            for (int i = 0; i < dsDoc.Tables[0].Rows.Count; i++)
            {
                DAO_Assign_Doc DAO = new DAO_Assign_Doc();
                DAO.SelectedId           = dsDoc.Tables[0].Rows[i][0].ToString();
                DAO.SelectedText         = objBillSysDocBO.GetFullPathOfNode(dsDoc.Tables[0].Rows[i][0].ToString());
                DAO.SelectedSpeciality   = objBillSysDocBO.GetSpecialityNameUsingId(dsDoc.Tables[0].Rows[i][1].ToString());
                DAO.SelectedSpecialityID = dsDoc.Tables[0].Rows[i][1].ToString();
                DAO.ORDER             = Convert.ToInt32(dsDoc.Tables[0].Rows[i][2]);
                DAO.REQUIRED_MULTIPLE = Convert.ToBoolean(dsDoc.Tables[0].Rows[i][3]);
                ListItem lst = new ListItem();
                lst.Text  = DAO.SelectedSpeciality.ToString() + DAO.SelectedText.ToString();
                lst.Value = DAO.SelectedId.ToString();
                lbAllAssignedDoc.Items.Add(lst);
            }
        }
        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);
        }

        #region "check version readonly or not"
        string app_status = ((Bill_Sys_BillingCompanyObject)Session["APPSTATUS"]).SZ_READ_ONLY.ToString();
        if (app_status.Equals("True"))
        {
            Bill_Sys_ChangeVersion cv = new Bill_Sys_ChangeVersion(this.Page);
            cv.MakeReadOnlyPage("Bill_Sys_DocumentType.aspx");
        }
        #endregion

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