Пример #1
0
    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());
        }
        try
        {
            int      Count = 0;
            DateTime currentdate;
            currentdate = DateTime.Today;
            DateTime inserted_date;
            inserted_date = Convert.ToDateTime(txtAddDate.Text);

            if (DateTime.Compare(inserted_date, currentdate) > 0)
            {
                lblMsg.Text    = "Selected Date should be less to Current Date";
                lblMsg.Visible = true;
                return;
            }

            if (lstProcedureCode.Items.Count > 0)
            {
                foreach (ListItem li in lstProcedureCode.Items)
                {
                    if (li.Selected == true)
                    {
                        Count = Count + 1;
                    }
                }

                if (Count == 0)
                {
                    lblMsg.Text    = "Select atleast 1 procedure code";
                    lblMsg.Visible = true;
                    return;
                }
            }

            Bill_Sys_Visit_BO _bill_Sys_Visit_BO = new Bill_Sys_Visit_BO();
            CaseDetailsBO     objcaseid          = new CaseDetailsBO();
            string            CompanyID          = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            string            DoctorID           = extddlDoctor.Text;
            string            ChkDate            = txtAddDate.Text;
            string            VisitType          = extddlVisitType.Text;
            string            CaseID;
            int flag = 0;


            string[]  arrlstCaseNo     = txtCaseNo.Text.Split(new char[] { ',' });
            ArrayList arrlstAddDetails = new ArrayList();

            Bill_Sys_AddVisit_DAO obj_bill_getset_value;
            for (int i = 0; i < arrlstCaseNo.Length; i++)
            {
                obj_bill_getset_value                  = new Bill_Sys_AddVisit_DAO();
                obj_bill_getset_value.CaseNo           = arrlstCaseNo[i];
                obj_bill_getset_value.CompanyId        = CompanyID;
                obj_bill_getset_value.DoctorID         = DoctorID;
                obj_bill_getset_value.EventDate        = ChkDate;
                obj_bill_getset_value.EventEndTimeType = "AM";
                obj_bill_getset_value.EventTimeType    = "AM";
                obj_bill_getset_value.EventEndTime     = "9.00";
                obj_bill_getset_value.EventNote        = "";
                obj_bill_getset_value.IStatus          = "2";
                obj_bill_getset_value.EventTime        = "8.30";
                obj_bill_getset_value.TypeCodeId       = "TY000000000000000003";
                obj_bill_getset_value.VisitTypeId      = VisitType;

                arrlstAddDetails.Add(obj_bill_getset_value);
            }

            ArrayList arrlstProcedureCode = new ArrayList();

            foreach (ListItem li in lstProcedureCode.Items)
            {
                obj_bill_getset_value = new Bill_Sys_AddVisit_DAO();
                if (li.Selected == true)
                {
                    obj_bill_getset_value.ProcedureCode = li.Value.ToString();
                    arrlstProcedureCode.Add(obj_bill_getset_value);
                    flag = 1;
                }
            }

            if (flag == 1)
            {
                Bill_Sys_Bulk_Visits objVisits = _bill_Sys_Visit_BO.InsertBulkVisit(arrlstAddDetails, arrlstProcedureCode);
                if (objVisits.InValidList != null)
                {
                    if (objVisits.InValidList.Count != 0)
                    {
                        // show list of in-valid case numbers. "Visits could not be added to these cases"
                        lblInvalidCaseNo.Text = "";
                        for (int i = 0; i < objVisits.InValidList.Count; i++)
                        {
                            lblInvalidCaseNo.Text += objVisits.InValidList[i].ToString() + ",";
                        }
                        lblInvalidCaseNo.Text = lblInvalidCaseNo.Text.Substring(0, lblInvalidCaseNo.Text.Length - 1);

                        trInvalid.Visible = true;
                    }
                }

                if (objVisits.ValidList != null)
                {
                    if (objVisits.ValidList.Count != 0)
                    {
                        // show list of valid case numbers. "Visits that could be added to the cases"
                        lblValidCaseNo.Text = "";
                        for (int i = 0; i < objVisits.ValidList.Count; i++)
                        {
                            lblValidCaseNo.Text += objVisits.ValidList[i].ToString() + ",";
                        }
                        lblValidCaseNo.Text = lblValidCaseNo.Text.Substring(0, lblValidCaseNo.Text.Length - 1);
                        trValid.Visible     = true;
                    }
                }
                pnlChkCaseno.Visible = true;
                ClearControl();
            }

            else if (flag == 0)
            {
                Bill_Sys_Bulk_Visits objVisits = _bill_Sys_Visit_BO.InsertBulkVisit(arrlstAddDetails, arrlstProcedureCode);
                if (objVisits.InValidList != null)
                {
                    if (objVisits.InValidList.Count != 0)
                    {
                        // show list of in-valid case numbers. "Visits could not be added to these cases"
                        for (int i = 0; i < objVisits.InValidList.Count; i++)
                        {
                            lblInvalidCaseNo.Text += objVisits.InValidList[i].ToString() + ",";
                        }
                        lblInvalidCaseNo.Text = lblInvalidCaseNo.Text.Substring(0, lblInvalidCaseNo.Text.Length - 1);

                        trInvalid.Visible = true;
                    }
                }

                if (objVisits.ValidList != null)
                {
                    if (objVisits.ValidList.Count != 0)
                    {
                        // show list of valid case numbers. "Visits that could be added to the cases"
                        for (int i = 0; i < objVisits.ValidList.Count; i++)
                        {
                            lblValidCaseNo.Text += objVisits.ValidList[i].ToString() + ",";
                        }
                        lblValidCaseNo.Text = lblValidCaseNo.Text.Substring(0, lblValidCaseNo.Text.Length - 1);
                        trValid.Visible     = true;
                    }
                }
                pnlChkCaseno.Visible = true;
                ClearControl();
            }
        }
        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());
        }
    }
Пример #2
0
    public Bill_Sys_Bulk_Visits InsertBulkVisit(ArrayList p_arrCaseNo, ArrayList p_arrProcedureCode)
    {
        ArrayList            arrayLists       = new ArrayList();
        ArrayList            arrayLists1      = new ArrayList();
        Bill_Sys_Bulk_Visits billSysBulkVisit = null;

        this.sqlCon = new SqlConnection(this.strConn);
        this.sqlCon.Open();
        for (int i = 0; i < p_arrCaseNo.Count; i++)
        {
            SqlParameter sqlParameter = new SqlParameter();
            try
            {
                Bill_Sys_AddVisit_DAO billSysAddVisitDAO = new Bill_Sys_AddVisit_DAO();
                billSysAddVisitDAO = (Bill_Sys_AddVisit_DAO)p_arrCaseNo[i];
                this.sqlCmd        = new SqlCommand("SP_INSERT_BULK_TXN_CALENDAR_EVENT", this.sqlCon)
                {
                    CommandType = CommandType.StoredProcedure
                };
                this.sqlCmd.Parameters.AddWithValue("@SZ_CASE_NO", billSysAddVisitDAO.CaseNo);
                this.sqlCmd.Parameters.AddWithValue("@DT_EVENT_DATE", billSysAddVisitDAO.EventDate);
                this.sqlCmd.Parameters.AddWithValue("@DT_EVENT_TIME", billSysAddVisitDAO.EventTime);
                this.sqlCmd.Parameters.AddWithValue("@SZ_EVENT_NOTES", billSysAddVisitDAO.EventNote);
                this.sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", billSysAddVisitDAO.CompanyId);
                this.sqlCmd.Parameters.AddWithValue("@SZ_DOCTOR_ID", billSysAddVisitDAO.DoctorID);
                this.sqlCmd.Parameters.AddWithValue("@SZ_TYPE_CODE_ID", billSysAddVisitDAO.TypeCodeId);
                this.sqlCmd.Parameters.AddWithValue("@DT_EVENT_TIME_TYPE", billSysAddVisitDAO.EventTimeType);
                this.sqlCmd.Parameters.AddWithValue("@DT_EVENT_END_TIME_TYPE", billSysAddVisitDAO.EventEndTimeType);
                this.sqlCmd.Parameters.AddWithValue("@DT_EVENT_END_TIME", billSysAddVisitDAO.EventEndTime);
                this.sqlCmd.Parameters.AddWithValue("@I_STATUS", billSysAddVisitDAO.IStatus);
                this.sqlCmd.Parameters.AddWithValue("@SZ_VISIT_TYPE", billSysAddVisitDAO.VisitTypeId);
                this.sqlCmd.Parameters.AddWithValue("@FLAG", "ADD");
                SqlParameter sqlParameter1 = new SqlParameter("@SZ_SUCCESS_ID", SqlDbType.NVarChar, 20)
                {
                    Direction = ParameterDirection.Output
                };
                this.sqlCmd.Parameters.Add(sqlParameter1);
                SqlParameter sqlParameter2 = new SqlParameter("@SZ_EVENT_ID", SqlDbType.NVarChar, 20)
                {
                    Direction = ParameterDirection.Output
                };
                this.sqlCmd.Parameters.Add(sqlParameter2);
                this.sqlCmd.ExecuteNonQuery();
                int num = 0;
                try
                {
                    num = Convert.ToInt32(sqlParameter2.Value);
                }
                catch (Exception ex)
                {
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    num = 0;
                }
                string str = "";
                if (num != 0)
                {
                    str = sqlParameter1.Value.ToString();
                }
                int count = p_arrProcedureCode.Count;
                if (p_arrProcedureCode.Count != 0 && num != 0 && str != null && !str.Equals(""))
                {
                    Bill_Sys_AddVisit_DAO item = null;
                    for (int j = 0; j < p_arrProcedureCode.Count; j++)
                    {
                        SqlCommand sqlCommand = new SqlCommand("SP_SAVE_REFERRAL_PROC_CODE", this.sqlCon)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        item = new Bill_Sys_AddVisit_DAO();
                        item = (Bill_Sys_AddVisit_DAO)p_arrProcedureCode[j];
                        sqlCommand.Parameters.AddWithValue("@SZ_PROC_CODE", item.ProcedureCode);
                        sqlCommand.Parameters.AddWithValue("@I_EVENT_ID", num.ToString());
                        sqlCommand.Parameters.AddWithValue("@I_STATUS", "2");
                        sqlCommand.ExecuteNonQuery();
                    }
                }
                if (str == "")
                {
                    arrayLists.Add(billSysAddVisitDAO.CaseNo);
                }
                else if (str != "")
                {
                    arrayLists1.Add(billSysAddVisitDAO.CaseNo);
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
        if (this.sqlCon.State == ConnectionState.Open)
        {
            this.sqlCon.Close();
        }
        billSysBulkVisit = new Bill_Sys_Bulk_Visits()
        {
            InValidList = arrayLists,
            ValidList   = arrayLists1
        };
        return(billSysBulkVisit);
    }