예제 #1
0
 protected void LoadClinicCombo(AnestheticServiceNote asn)
 {
     // clear previous items
     rdcbClinic.Items.Clear();
     foreach (Clinic c in ctx.Clinics)
     {
         rdcbClinic.Items.Add(new RadComboBoxItem(c.Name, c.ClinicId.ToString()));
     }
     if (asn != null)
     {
         rdcbClinic.SelectedValue = asn.Clinic.ClinicId.ToString();
     }
     else
     {
         if (cl != null)
         {
             rdcbClinic.SelectedValue = cl.ClinicId.ToString();
         }
         else
         {
             rdcbClinic.Items.Add(new RadComboBoxItem(" ", ""));
             rdcbClinic.SelectedValue = "";
         }
     }
 }
 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
 {
     RadGrid1.Rebind();
     if (e.Argument == "new")
     {
         RadGrid1.Rebind();
         RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1;
     }
     if (e.Argument == "yes")
     {
         if (Session["DeleteId"] != null)
         {
             try
             {
                 anestheticServiceNoteId = (int)Session["DeleteId"];
                 AnestheticServiceNote asn = CntAriCli.GetAnestheticServiceNote(anestheticServiceNoteId, ctx);
                 CntAriCli.DeleteAnestheticServiceNote(asn, ctx);
                 RadGrid1.Rebind();
                 Session["DeleteId"] = null;
             }
             catch (Exception ex)
             {
                 Session["Exception"] = ex;
                 string command = String.Format("showDialog('Error','{0}','error',null, 0, 0)"
                                                , Resources.GeneralResource.DeleteRecordFail);
                 RadAjaxManager1.ResponseScripts.Add(command);
             }
         }
     }
 }
예제 #3
0
    protected void UnloadData(AnestheticServiceNote asn)
    {
        asn.ServiceNoteDate = (DateTime)rddpServiceNoteDate.SelectedDate;
        clinicId            = Int32.Parse(rdcbClinic.SelectedValue);
        asn.Clinic          = CntAriCli.GetClinic(clinicId, ctx);
        asn.User            = CntAriCli.GetUser(user.UserId, ctx);
        //
        decimal tt = 0;

        decimal.TryParse(txtTotal.Text, out tt);
        asn.Total = tt;
        //
        asn.Chk1 = chkChecked.Checked;
        asn.Chk2 = chkCkecked2.Checked;
        asn.Chk3 = chkChecked3.Checked;
        //customerId = Int32.Parse(txtCustomerId.Text);
        asn.Customer = CntAriCli.GetCustomer(int.Parse(rdcComercialName.SelectedValue), ctx);
        if (rdcProfessionalName.SelectedValue != "")
        {
            professionalId   = Int32.Parse(rdcProfessionalName.SelectedValue);
            asn.Professional = CntAriCli.GetProfessional(professionalId, ctx);
        }
        else
        {
            asn.Professional = null;
        }
        if (rdcSurgeonName.SelectedValue != "")
        {
            surgeonId   = Int32.Parse(rdcSurgeonName.SelectedValue);
            asn.Surgeon = CntAriCli.GetProfessional(surgeonId, ctx);
        }
        else
        {
            asn.Surgeon = null;
        }

        asn.Procedures.Clear();
        ctx.SaveChanges();
        //ctx.Delete(asn.Procedures);

        if (rdcProcedureName1.SelectedValue != "")
        {
            procedureId = Int32.Parse(rdcProcedureName1.SelectedValue);
            asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx));
        }
        if (rdcProcedureName2.SelectedValue != "")
        {
            procedureId = Int32.Parse(rdcProcedureName2.SelectedValue);
            asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx));
        }
        if (rdcProcedureName3.SelectedValue != "")
        {
            procedureId = Int32.Parse(rdcProcedureName3.SelectedValue);
            asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx));
        }
    }
예제 #4
0
    protected bool CreateChange()
    {
        if (asn == null)
        {
            firstTime = true;
            asn       = new AnestheticServiceNote();
            UnloadData(asn);
            ctx.Add(asn);
            lschk = CntAriCli.SaveTckChecks(asn);
        }
        else
        {
            asn = CntAriCli.GetAnestheticServiceNote(anestheticServiceNoteId, ctx);
            //lschk = CntAriCli.SaveChecks(asn);
            lschk = CntAriCli.SaveTckChecks(asn);
            bool procedurechanged = false;
            if (Session["procedurechanged"] != null)
            {
                procedurechanged = (bool)Session["procedurechanged"];
            }
            if (procedurechanged)
            {
                firstTime = true;
                Session["procedurechanged"] = null;

                IList <AnestheticTicket> tickets = asn.AnestheticTickets;

                foreach (AnestheticTicket item in tickets)
                {
                    ctx.Delete(CntAriCli.GetTicket(item.TicketId, ctx));
                }
                ctx.SaveChanges();

                asn.AnestheticTickets.Clear();
                asn.Procedures.Clear();
            }
            UnloadData(asn);
        }
        //bool res = UpdateRelatedTickets(asn, lschk);
        // ---
        bool res = CntAriCli.UpdateRelatedTckV2(asn, lschk, ctx);

        // Update anesthetic service note total
        asn.Total = asn.AnestheticTickets.Sum(x => x.Amount);
        ctx.SaveChanges();
        if (firstTime)
        {
            firstTime = false;
            Response.Redirect(String.Format("AnestheticServiceNoteForm.aspx?AnestheticServiceNoteId={0}", asn.AnestheticServiceNoteId));
        }
        return(res);
    }
예제 #5
0
    protected bool AreThereTicketsChecked(AnestheticServiceNote asn)
    {
        bool res = false;
        var  rs  = from t in asn.AnestheticTickets
                   where t.Checked == true
                   select t;

        if (rs.Count() > 0)
        {
            res = true;
        }
        return(res);
    }
예제 #6
0
        public RptAnesNote(int idanesnote, AriClinicContext ctx1)
            : this()
        {
            ctx1        = new AriClinicContext("AriClinicContext");
            companyname = CntAriCli.GetHealthCompany(ctx1).Name;
            AnestheticServiceNote aneNote = CntAriCli.GetAnestheticServiceNote(idanesnote, ctx1);

            if (aneNote != null)
            {
                this.DataSource = aneNote;
                //this.subReport1.ReportSource.DataSource = aneNote.AnestheticTickets;
                this.subReport1.Report.DataSource = aneNote.AnestheticTickets;
            }
        }
    protected void UnloadData(AnestheticTicket tck)
    {
        tck.TicketDate       = (DateTime)rddpTicketDate.SelectedDate;
        policyId             = Int32.Parse(rdcbPolicy.SelectedValue);
        tck.Policy           = CntAriCli.GetPolicy(policyId, ctx);
        insuranceServiceId   = Int32.Parse(txtInsuranceServiceId.Text);
        tck.InsuranceService = CntAriCli.GetInsuranceService(insuranceServiceId, ctx);
        clinicId             = Int32.Parse(rdcbClinic.SelectedValue);
        tck.Clinic           = CntAriCli.GetClinic(clinicId, ctx);
        tck.User             = CntAriCli.GetUser(user.UserId, ctx);
        tck.Description      = txtDescription.Text;
        tck.Amount           = Decimal.Parse(txtAmount.Text);
        tck.Checked          = chkChecked.Checked;
        if (txtProfessionalId.Text != "")
        {
            professionalId   = Int32.Parse(txtProfessionalId.Text);
            tck.Professional = CntAriCli.GetProfessional(professionalId, ctx);
        }
        else
        {
            tck.Professional = null;
        }
        if (txtSurgeonId.Text != "")
        {
            surgeonId   = Int32.Parse(txtSurgeonId.Text);
            tck.Surgeon = CntAriCli.GetProfessional(surgeonId, ctx);
        }
        else
        {
            tck.Surgeon = null;
        }
        if (txtProcedureId.Text != "")
        {
            procedureId   = Int32.Parse(txtProcedureId.Text);
            tck.Procedure = CntAriCli.GetProcedure(procedureId, ctx);
        }
        else
        {
            tck.Procedure = null;
        }
        tck.Comments = txtComments.Text;

        // assign anesthetic note if any.
        if (asn != null)
        {
            asn = CntAriCli.GetAnestheticServiceNote(asn.AnestheticServiceNoteId, ctx);
            tck.AnestheticServiceNote = asn;
        }
    }
예제 #8
0
    protected bool UpdateRelatedTickets(AnestheticServiceNote asn, IList <SaveCheck> lschk)
    {
        try
        {
            ctx.Delete(asn.AnestheticTickets);
            asn.AnestheticTickets.Clear();
            CntAriCli.CheckAnestheticServiceNoteTickets(asn, ctx, lschk);
            if (firstTime)
            {
                firstTime = false;
                Response.Redirect(String.Format("AnestheticServiceNoteForm.aspx?AnestheticServiceNoteId={0}", asn.AnestheticServiceNoteId));
            }
        }
        catch (AriCliException ex)
        {
            string message = "";
            switch (ex.Number)
            {
            case 1:
                message = Resources.GeneralResource.NoPrimaryPolicy;
                break;

            case 2:
                message = Resources.GeneralResource.NoPainPump;
                break;

            case 3:
                message = Resources.GeneralResource.NoNomenclatorService;
                break;

            default:
                message = ex.Message;
                break;
            }
            string command = String.Format("showDialog('{0}','{1}','warning',null,0,0);"
                                           , Resources.GeneralResource.Warning
                                           , message);
            RadAjaxManager1.ResponseScripts.Add(command);
            Session["LinkId"] = asn.AnestheticServiceNoteId;
            return(false);
        }
        return(true);
    }
예제 #9
0
 protected void Page_Init(object sender, EventArgs e)
 {
     ctx = new AriClinicContext("AriClinicContext");
     // security control, it must be a user logged
     if (Session["User"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
         Process proc = (from p in ctx.Processes
                         where p.Code == "policy"
                         select p).FirstOrDefault <Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
     {
         type = Request.QueryString["Type"];
     }
     // read the realated patient
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat       = CntAriCli.GetPatient(patientId, ctx);
         cus       = pat.Customer;
     }
     // read passed customer if any
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus        = CntAriCli.GetCustomer(customerId, ctx);
     }
     //
     if (Request.QueryString["NotPaid"] != null)
     {
         notPaid = true;
     }
     //
     if (type == "InTab")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         RadGrid1.Columns.FindByDataField("Policy.Customer.FullName").Visible = false;
         //
         RadGrid1.PageSize = 6;
     }
     else
     {
     }
     if (Request.QueryString["AnestheticServiceNoteId"] != null)
     {
         anestheticServiceNoteId = Int32.Parse(Request.QueryString["AnestheticServiceNoteId"]);
         asn = CntAriCli.GetAnestheticServiceNote(anestheticServiceNoteId, ctx);
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // here the fields that must be hidden
         RadGrid1.Columns.FindByDataField("TicketDate").Visible = false;
         RadGrid1.Columns.FindByDataField("Policy.Customer.FullName").Visible = false;
         RadGrid1.Columns.FindByDataField("Checked").Visible     = false;
         RadGrid1.Columns.FindByDataField("Clinic.Name").Visible = false;
     }
     if (Request.QueryString["ServiceNoteId"] != null)
     {
         serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
         sn            = CntAriCli.GetServiceNote(serviceNoteId, ctx);
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // here the fields that must be hidden
         RadGrid1.Columns.FindByDataField("TicketDate").Visible = false;
         RadGrid1.Columns.FindByDataField("Policy.Customer.FullName").Visible = false;
         RadGrid1.Columns.FindByDataField("Checked").Visible     = false;
         RadGrid1.Columns.FindByDataField("Clinic.Name").Visible = false;
         RadGrid1.Columns.FindByDataField("Paid").Visible        = false;
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
     //
 }
예제 #10
0
    protected void Page_Init(object sender, EventArgs e)
    {
        ctx = new AriClinicContext("AriClinicContext");
        // security control, it must be a user logged
        if (Session["User"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "ticket"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }


        if (Request.QueryString["CustomerId"] != null)
        {
            customerId = Int32.Parse(Request.QueryString["CustomerId"]);
            cus        = CntAriCli.GetCustomer(customerId, ctx);
            //txtCustomerId.Text = cus.PersonId.ToString();

            rdcComercialName.Items.Clear();
            rdcComercialName.Items.Add(new RadComboBoxItem(cus.FullName, cus.PersonId.ToString()));
            rdcComercialName.SelectedValue = cus.PersonId.ToString();
            rdcComercialName.Enabled       = false;

            btnCustomerId.Visible = false;
        }
        else
        {
            LoadClinicCombo(null);
        }
        if (Session["Clinic"] != null)
        {
            cl = (Clinic)Session["Clinic"];
        }
        //
        if (Request.QueryString["AnestheticServiceNoteId"] != null)
        {
            anestheticServiceNoteId = Int32.Parse(Request.QueryString["AnestheticServiceNoteId"]);
            asn        = CntAriCli.GetAnestheticServiceNote(anestheticServiceNoteId, ctx);
            cus        = asn.Customer;
            customerId = cus.PersonId;
            if (!IsPostBack)
            {
                LoadData(asn);
            }
            // Load internal frame
            HtmlControl frm = (HtmlControl)this.FindControl("ifTickets");
            frm.Attributes["src"] = String.Format("TicketGrid.aspx?AnestheticServiceNoteId={0}", anestheticServiceNoteId);
        }
        else
        {
            // If there isn't a ticket the default date must be today
            rddpServiceNoteDate.SelectedDate = DateTime.Now;
            LoadClinicCombo(null);
        }
    }
예제 #11
0
 protected void LoadData(AnestheticServiceNote asn)
 {
     txtAnestheticServiceNoteId.Text = asn.AnestheticServiceNoteId.ToString();
     //txtCustomerId.Text = asn.Customer.PersonId.ToString();
     rdcComercialName.Items.Clear();
     rdcComercialName.Items.Add(new RadComboBoxItem(asn.Customer.FullName, asn.Customer.PersonId.ToString()));
     rdcComercialName.SelectedValue   = asn.Customer.PersonId.ToString();
     rddpServiceNoteDate.SelectedDate = asn.ServiceNoteDate;
     LoadClinicCombo(asn);
     txtTotal.Text = asn.Total.ToString();
     //
     chkChecked.Checked  = asn.Chk1;
     chkCkecked2.Checked = asn.Chk2;
     //chkCkecked2.Checked = AreThereTicketsChecked(asn);
     chkChecked3.Checked = asn.Chk3;
     if (asn.Professional != null)
     {
         //txtProfessionalId.Text = asn.Professional.PersonId.ToString();
         rdcProfessionalName.Items.Clear();
         rdcProfessionalName.Items.Add(new RadComboBoxItem(asn.Professional.FullName, asn.Professional.PersonId.ToString()));
         rdcProfessionalName.SelectedValue = asn.Professional.PersonId.ToString();
     }
     if (asn.Surgeon != null)
     {
         //txtSurgeonId.Text = asn.Surgeon.PersonId.ToString();
         rdcSurgeonName.Items.Clear();
         rdcSurgeonName.Items.Add(new RadComboBoxItem(asn.Surgeon.FullName, asn.Surgeon.PersonId.ToString()));
         rdcSurgeonName.SelectedValue = asn.Surgeon.PersonId.ToString();
         //txtSurgeonName.Text = asn.Surgeon.FullName;
     }
     if (asn.Procedures.Count > 0 && asn.Procedures[0] != null)
     {
         //txtProcedureId1.Text = asn.Procedures[0].ProcedureId.ToString();
         rdcProcedureName1.Items.Clear();
         rdcProcedureName1.Items.Add(new RadComboBoxItem(asn.Procedures[0].Name, asn.Procedures[0].ProcedureId.ToString()));
         rdcProcedureName1.SelectedValue = asn.Procedures[0].ProcedureId.ToString();
         //txtProcedureName1.Text = asn.Procedures[0].Name;
     }
     if (asn.Procedures.Count > 1)
     {
         if (asn.Procedures[1] != null)
         {
             //txtProcedureId2.Text = asn.Procedures[1].ProcedureId.ToString();
             //txtProcedureName2.Text = asn.Procedures[1].Name;
             rdcProcedureName2.Items.Clear();
             rdcProcedureName2.Items.Add(new RadComboBoxItem(asn.Procedures[1].Name, asn.Procedures[1].ProcedureId.ToString()));
             rdcProcedureName2.SelectedValue = asn.Procedures[1].ProcedureId.ToString();
         }
     }
     if (asn.Procedures.Count > 2)
     {
         if (asn.Procedures[2] != null)
         {
             //txtProcedureId3.Text = asn.Procedures[2].ProcedureId.ToString();
             //txtProcedureName3.Text = asn.Procedures[2].Name;
             rdcProcedureName3.Items.Clear();
             rdcProcedureName3.Items.Add(new RadComboBoxItem(asn.Procedures[2].Name, asn.Procedures[2].ProcedureId.ToString()));
             rdcProcedureName3.SelectedValue = asn.Procedures[2].ProcedureId.ToString();
         }
     }
 }