Beispiel #1
0
    protected void SetSessionValues()
    {
        // First check if a user is logged
        if (Session["User"] == null)
            Response.Redirect("Default.aspx");
        user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx);
        lblUser.Text = user.Name;

        // Clinic
        if (Session["Clinic"] != null)
        {
            cl =CntAriCli.GetClinic((Session["Clinic"] as Clinic).ClinicId, ctx);
            lblUser.Text = String.Format("{0} ({1})", user.Name, cl.Name);
        }

        // Assign general skin
        if (Session["Skin"] != null)
            RadSkinManager1.Skin = (string)Session["Skin"];

        // Show company and user values
        if (Session["Company"] != null)
        {
            hc = CntAriCli.GetHealthCompany(ctx);
            lblHealthcareCompany.Text = hc.Name;
        }
    }
Beispiel #2
0
 ///<summary>Inserts one Clinic into the database.  Returns the new priKey.</summary>
 internal static long Insert(Clinic clinic)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         clinic.ClinicNum=DbHelper.GetNextOracleKey("clinic","ClinicNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(clinic,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     clinic.ClinicNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(clinic,false);
     }
 }
Beispiel #3
0
 ///<summary>Inserts one Clinic into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Clinic clinic,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         clinic.ClinicNum=ReplicationServers.GetKey("clinic","ClinicNum");
     }
     string command="INSERT INTO clinic (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ClinicNum,";
     }
     command+="Description,Address,Address2,City,State,Zip,Phone,BankNumber,DefaultPlaceService,InsBillingProv) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(clinic.ClinicNum)+",";
     }
     command+=
          "'"+POut.String(clinic.Description)+"',"
         +"'"+POut.String(clinic.Address)+"',"
         +"'"+POut.String(clinic.Address2)+"',"
         +"'"+POut.String(clinic.City)+"',"
         +"'"+POut.String(clinic.State)+"',"
         +"'"+POut.String(clinic.Zip)+"',"
         +"'"+POut.String(clinic.Phone)+"',"
         +"'"+POut.String(clinic.BankNumber)+"',"
         +    POut.Int   ((int)clinic.DefaultPlaceService)+","
         +    POut.Long  (clinic.InsBillingProv)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         clinic.ClinicNum=Db.NonQ(command,true);
     }
     return clinic.ClinicNum;
 }
Beispiel #4
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Clinic> TableToList(DataTable table){
			List<Clinic> retVal=new List<Clinic>();
			Clinic clinic;
			for(int i=0;i<table.Rows.Count;i++) {
				clinic=new Clinic();
				clinic.ClinicNum          = PIn.Long  (table.Rows[i]["ClinicNum"].ToString());
				clinic.Description        = PIn.String(table.Rows[i]["Description"].ToString());
				clinic.Address            = PIn.String(table.Rows[i]["Address"].ToString());
				clinic.Address2           = PIn.String(table.Rows[i]["Address2"].ToString());
				clinic.City               = PIn.String(table.Rows[i]["City"].ToString());
				clinic.State              = PIn.String(table.Rows[i]["State"].ToString());
				clinic.Zip                = PIn.String(table.Rows[i]["Zip"].ToString());
				clinic.Phone              = PIn.String(table.Rows[i]["Phone"].ToString());
				clinic.BankNumber         = PIn.String(table.Rows[i]["BankNumber"].ToString());
				clinic.DefaultPlaceService= (OpenDentBusiness.PlaceOfService)PIn.Int(table.Rows[i]["DefaultPlaceService"].ToString());
				clinic.InsBillingProv     = PIn.Long  (table.Rows[i]["InsBillingProv"].ToString());
				clinic.Fax                = PIn.String(table.Rows[i]["Fax"].ToString());
				clinic.EmailAddressNum    = PIn.Long  (table.Rows[i]["EmailAddressNum"].ToString());
				clinic.DefaultProv        = PIn.Long  (table.Rows[i]["DefaultProv"].ToString());
				clinic.SmsContractDate    = PIn.DateT (table.Rows[i]["SmsContractDate"].ToString());
				clinic.SmsContractName    = PIn.String(table.Rows[i]["SmsContractName"].ToString());
				retVal.Add(clinic);
			}
			return retVal;
		}
Beispiel #5
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 == "usergroup"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ClinicId"] != null)
        {
            clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
            cl = (from c in ctx.Clinics
                  where c.ClinicId == clinicId
                  select c).FirstOrDefault<Clinic>();
            LoadData(cl);
        }
    }
    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);
            }
        
    }
    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 == "payment"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }
        if (Session["Clinic"] != null)
            cl = (Clinic)Session["Clinic"];
        // 

        //
        if (Request.QueryString["ServiceNoteId"] != null)
        {
            serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
            snote = CntAriCli.GetServiceNote(serviceNoteId, ctx);
            // calcute total amount and total payments
            //txtServiceNoteData.Text = String.Format("ID:{0} Fecha:{1:dd/MM/yy} Total:{2} Pagado:{3}", 
            //    snote.ServiceNoteId, 
            //    snote.ServiceNoteDate,
            //    CntAriCli.GetServiceNoteAmount(snote), 
            //    CntAriCli.GetServiceNoteAmountPay(snote));
            txtServiceNoteData.Text = String.Format("{0} ({1:dd/MM/yy}) T:{2:0.00} P:{3:0.00}", snote.Customer.ComercialName, snote.ServiceNoteDate, snote.Total, snote.Paid);
            txtAmount.Value = (double)CntAriCli.GetUnpaid(snote, ctx);
            //txtAmount.Text = string.Format("{0:#.#}", CntAriCli.GetUnpaid(snote, ctx));
            SetFocus(rdcbClinic);
        }

        if (Request.QueryString["GeneralPaymentId"] != null)
        {
            paymentId = Int32.Parse(Request.QueryString["GeneralPaymentId"]);
            gpay = CntAriCli.GetGeneralPayment(paymentId, ctx);
            LoadData(gpay);
        }
        else
        {
            rddpGeneralPaymentDate.SelectedDate = DateTime.Now;
            LoadPaymentMethodCombo(null);
            LoadClinicCombo(null);
        }
    }
Beispiel #8
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 == "payment"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     if (Session["Clinic"] != null)
         cl = (Clinic)Session["Clinic"];
     // 
     if (Request.QueryString["PaymentId"] != null)
     {
         paymentId = Int32.Parse(Request.QueryString["PaymentId"]);
         pay = CntAriCli.GetPayment(paymentId, ctx);
         LoadData(pay);
     }
     else
     {
         rddpPaymentDate.SelectedDate = DateTime.Now;
         LoadPaymentMethodCombo(null);
     }
     //
     if (Request.QueryString["TicketId"] != null)
     {
         ticketId = int.Parse(Request.QueryString["TicketId"]);
         tck = CntAriCli.GetTicket(ticketId, ctx);
         txtTicketId.Text = tck.TicketId.ToString();
         txtTicketData.Text = String.Format("{0} ({1}: {2:C})"
             , tck.Policy.Customer.FullName
             , tck.Description
             , tck.Amount);
         decimal diff = tck.Amount - tck.Paid;
         txtAmount.Text = diff.ToString();
         SetFocus(rdcbPaymentMethod);
     }
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     ctx = new AriClinicContext("AriClinicContext");
     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 == "payment"
                         select p).FirstOrDefault<Process>();
         permission = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = permission.Modify;
     }
     if (Session["Clinic"] != null)
     {
         clinic = (Clinic)Session["Clinic"];
     }
     if (Request.QueryString["ServiceNoteId"] != null)
     {
         serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
         serviceNote = CntAriCli.GetServiceNote(serviceNoteId, ctx);
         txtServiceNoteData.Text = String.Format("{0} ({1:dd/MM/yy}) T:{2:0.00} P:{3:0.00}", serviceNote.Customer.ComercialName, serviceNote.ServiceNoteDate, serviceNote.Total, serviceNote.Paid);
         txtAmount.Value = (double)CntAriCli.GetUnpaid(serviceNote, ctx);
         if (serviceNote.Clinic != null) clinic = serviceNote.Clinic;
         SetFocus(rdcbClinic);
     }
     if (Request.QueryString["GeneralPaymentId"] != null)
     {
         generalPaymentId = Int32.Parse(Request.QueryString["GeneralPaymentId"]);
         generalPayment = CntAriCli.GetGeneralPayment(generalPaymentId, ctx);
         serviceNote = generalPayment.ServiceNote;
         LoadData(generalPayment);
     }
     else
     {
         rddpGeneralPaymentDate.SelectedDate = DateTime.Now;
         LoadPaymentMethodCombo(null);
         LoadClinicCombo(clinic);
     }
 }
    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 == "amendmentinvoice"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }
        hc = CntAriCli.GetHealthCompany(ctx);
        // 
        if (Request.QueryString["AmendmentInvoiceId"] != null)
        {
            amendmentInvoiceId = Int32.Parse(Request.QueryString["AmendmentInvoiceId"]);
            aInv = CntAriCli.GetAmendementInvoice(amendmentInvoiceId, ctx);
            LoadData(aInv);
        }
        else
        {
            // deafault values
            rddpInvoiceDate.SelectedDate = DateTime.Now;
            txtYear.Text = DateTime.Now.Year.ToString();
            txtInvoiceSerial.Text = hc.InvoiceSerial;
        }
        //
        if (Request.QueryString["Caller"] != null)
            caller = Request.QueryString["Caller"];

        if (Session["Clinic"] != null)
            cl = (Clinic)Session["Clinic"];
        // always read Healt care company
    }
Beispiel #11
0
            public void CorrectModelMapping()
            {
                //Arrange
                var dataStorage = new Mock <IDataStorage>();
                var repository  = new QueryRepository(dataStorage.Object);

                var clinic = new Clinic {
                    Caption = "Clinic"
                };
                var doctor = new User {
                    FirstName = "DoctorFirst", LastName = "DoctorLast", Clinic = clinic
                };
                var patient = new Patient {
                    Doctor = doctor
                };
                var visit = new Visit {
                    Caption = "Visit", Patient = patient
                };
                var form1 = new Form {
                    FormType = FormType.Happiness, Visit = visit
                };
                var question1 = new Question {
                    Caption = "QuestionCaption1", Form = form1
                };
                var query1 = new Query {
                    Id = 1, Question = question1
                };

                var form2 = new Form {
                    FormType = FormType.Inventory, Visit = visit
                };
                var question2 = new Question {
                    Caption = "QuestionCaption2", Form = form2
                };
                var query2 = new Query {
                    Id = 2, Question = question2, AnswerText = "Answer"
                };

                dataStorage.Setup(ds => ds.GetData <Query>()).Returns(new List <Query> {
                    query1, query2
                });

                //Act
                var result = repository.GetQueriesReportData();

                //Assert
                Assert.That(result, Is.Not.Null);
                Assert.That(result.Count(), Is.EqualTo(2));
                var dto = result.ToList()[0];

                Assert.That(dto.FormType, Is.EqualTo(FormType.Happiness));
                Assert.That(dto.ClinicName, Is.EqualTo("Clinic"));
                Assert.That(dto.DoctorName, Is.EqualTo("DoctorFirst DoctorLast"));
                Assert.That(dto.QuestionName, Is.EqualTo("QuestionCaption1"));
                Assert.That(dto.IsOpen, Is.True);

                dto = result.ToList()[1];
                Assert.That(dto.FormType, Is.EqualTo(FormType.Inventory));
                Assert.That(dto.ClinicName, Is.EqualTo("Clinic"));
                Assert.That(dto.DoctorName, Is.EqualTo("DoctorFirst DoctorLast"));
                Assert.That(dto.QuestionName, Is.EqualTo("QuestionCaption2"));
                Assert.That(dto.IsOpen, Is.False);
            }
Beispiel #12
0
        private void FormVaccinePatEdit_Load(object sender, EventArgs e)
        {
            Patient pat = Patients.GetLim(VaccinePatCur.PatNum);

            if (pat.Age != 0 && pat.Age < 3)
            {
                labelDocument.Text = "Document reason not given below.  Reason can include a contraindication due to a specific allergy, adverse effect, intollerance, or specific disease.";              //less leeway with reasons for kids.
            }
            _listVaccineDefs = VaccineDefs.GetDeepCopy();
            comboVaccine.Items.Clear();
            for (int i = 0; i < _listVaccineDefs.Count; i++)
            {
                comboVaccine.Items.Add(_listVaccineDefs[i].CVXCode + " - " + _listVaccineDefs[i].VaccineName);
                if (_listVaccineDefs[i].VaccineDefNum == VaccinePatCur.VaccineDefNum)
                {
                    comboVaccine.SelectedIndex = i;
                }
            }
            if (!IsNew && VaccinePatCur.VaccineDefNum != 0)
            {
                VaccineDef       vaccineDef   = VaccineDefs.GetOne(VaccinePatCur.VaccineDefNum);      //Need vaccine to get manufacturer.
                DrugManufacturer manufacturer = DrugManufacturers.GetOne(vaccineDef.DrugManufacturerNum);
                textManufacturer.Text = manufacturer.ManufacturerCode + " - " + manufacturer.ManufacturerName;
            }
            if (VaccinePatCur.DateTimeStart.Year > 1880)
            {
                textDateTimeStart.Text = VaccinePatCur.DateTimeStart.ToString();
            }
            if (VaccinePatCur.DateTimeEnd.Year > 1880)
            {
                textDateTimeStop.Text = VaccinePatCur.DateTimeEnd.ToString();
            }
            if (VaccinePatCur.AdministeredAmt != 0)
            {
                textAmount.Text = VaccinePatCur.AdministeredAmt.ToString();
            }
            _listDrugUnits = DrugUnits.GetDeepCopy();
            comboUnits.Items.Clear();
            comboUnits.Items.Add("none");
            comboUnits.SelectedIndex = 0;
            for (int i = 0; i < _listDrugUnits.Count; i++)
            {
                comboUnits.Items.Add(_listDrugUnits[i].UnitIdentifier);
                if (_listDrugUnits[i].DrugUnitNum == VaccinePatCur.DrugUnitNum)
                {
                    comboUnits.SelectedIndex = i + 1;
                }
            }
            textLotNum.Text = VaccinePatCur.LotNumber;
            if (VaccinePatCur.DateExpire.Year > 1880)
            {
                textDateExpiration.Text = VaccinePatCur.DateExpire.ToShortDateString();
            }
            listRefusalReason.Items.Clear();
            string[] arrayVaccineRefusalReasons = Enum.GetNames(typeof(VaccineRefusalReason));
            for (int i = 0; i < arrayVaccineRefusalReasons.Length; i++)
            {
                listRefusalReason.Items.Add(arrayVaccineRefusalReasons[i]);
                VaccineRefusalReason refusalReason = (VaccineRefusalReason)i;
                if (refusalReason == VaccinePatCur.RefusalReason)
                {
                    listRefusalReason.SelectedIndex = i;
                }
            }
            listCompletionStatus.Items.Clear();
            string[] arrayCompletionStatuses = Enum.GetNames(typeof(VaccineCompletionStatus));
            for (int i = 0; i < arrayCompletionStatuses.Length; i++)
            {
                listCompletionStatus.Items.Add(arrayCompletionStatuses[i]);
                VaccineCompletionStatus completionStatus = (VaccineCompletionStatus)i;
                if (completionStatus == VaccinePatCur.CompletionStatus)
                {
                    listCompletionStatus.SelectedIndex = i;
                }
            }
            textNote.Text = VaccinePatCur.Note;
            if (IsNew)
            {
                if (pat.ClinicNum == 0)
                {
                    VaccinePatCur.FilledCity = PrefC.GetString(PrefName.PracticeCity);
                    VaccinePatCur.FilledST   = PrefC.GetString(PrefName.PracticeST);
                }
                else
                {
                    Clinic clinic = Clinics.GetClinic(pat.ClinicNum);
                    VaccinePatCur.FilledCity = clinic.City;
                    VaccinePatCur.FilledST   = clinic.State;
                }
            }
            textFilledCity.Text = VaccinePatCur.FilledCity;
            textFilledSt.Text   = VaccinePatCur.FilledST;
            if (IsNew)
            {
                VaccinePatCur.UserNum = Security.CurUser.UserNum;
            }
            Userod user = Userods.GetUser(VaccinePatCur.UserNum);

            if (user != null)           //Will be null for vaccines entered in older versions, before the UserNum column was created.
            {
                textUser.Text = user.UserName;
            }
            _provNumSelectedOrdering = VaccinePatCur.ProvNumOrdering;
            comboProvNumOrdering.Items.Clear();
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProvNumOrdering.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == VaccinePatCur.ProvNumOrdering)
                {
                    comboProvNumOrdering.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (comboProvNumOrdering.SelectedIndex == -1)                                    //The provider exists but is hidden
            {
                comboProvNumOrdering.Text = Providers.GetLongDesc(_provNumSelectedOrdering); //Appends "(hidden)" to the end of the long description.
            }
            _provNumSelectedAdministering = VaccinePatCur.ProvNumAdminister;
            comboProvNumAdministering.Items.Clear();
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProvNumAdministering.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == VaccinePatCur.ProvNumAdminister)
                {
                    comboProvNumAdministering.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (comboProvNumAdministering.SelectedIndex == -1)                                         //The provider exists but is hidden
            {
                comboProvNumAdministering.Text = Providers.GetLongDesc(_provNumSelectedAdministering); //Appends "(hidden)" to the end of the long description.
            }
            comboAdministrationRoute.Items.Clear();
            string[] arrayVaccineAdministrationRoutes = Enum.GetNames(typeof(VaccineAdministrationRoute));
            for (int i = 0; i < arrayVaccineAdministrationRoutes.Length; i++)
            {
                comboAdministrationRoute.Items.Add(arrayVaccineAdministrationRoutes[i]);
                VaccineAdministrationRoute administrationRoute = (VaccineAdministrationRoute)i;
                if (administrationRoute == VaccinePatCur.AdministrationRoute)
                {
                    comboAdministrationRoute.SelectedIndex = i;
                }
            }
            comboAdministrationSite.Items.Clear();
            string[] arrayVaccineAdministrationSites = Enum.GetNames(typeof(VaccineAdministrationSite));
            for (int i = 0; i < arrayVaccineAdministrationSites.Length; i++)
            {
                comboAdministrationSite.Items.Add(arrayVaccineAdministrationSites[i]);
                VaccineAdministrationSite administrationSite = (VaccineAdministrationSite)i;
                if (administrationSite == VaccinePatCur.AdministrationSite)
                {
                    comboAdministrationSite.SelectedIndex = i;
                }
            }
            listAdministrationNote.Items.Clear();
            string[] arrayAdministrationNotes = Enum.GetNames(typeof(VaccineAdministrationNote));
            for (int i = 0; i < arrayAdministrationNotes.Length; i++)
            {
                listAdministrationNote.Items.Add(arrayAdministrationNotes[i]);
                VaccineAdministrationNote administrationNote = (VaccineAdministrationNote)i;
                if (administrationNote == VaccinePatCur.AdministrationNoteCode)
                {
                    listAdministrationNote.SelectedIndex = i;
                }
            }
            listAction.Items.Clear();
            string[] arrayVaccineActions = Enum.GetNames(typeof(VaccineAction));
            for (int i = 0; i < arrayVaccineActions.Length; i++)
            {
                listAction.Items.Add(arrayVaccineActions[i]);
                VaccineAction action = (VaccineAction)i;
                if (action == VaccinePatCur.ActionCode)
                {
                    listAction.SelectedIndex = i;
                }
            }
            _listVaccineObservations = VaccineObses.GetForVaccine(VaccinePatCur.VaccinePatNum);
            FillObservations();
        }
Beispiel #13
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 (user.Professionals.Count > 0)
         {
             prof = user.Professionals[0];
             txtProfessionalId.Text   = prof.PersonId.ToString();
             txtProfessionalName.Text = prof.FullName;
         }
     }
     //
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId            = Int32.Parse(Request.QueryString["CustomerId"]);
         cus                   = CntAriCli.GetCustomer(customerId, ctx);
         txtCustomerId.Text    = cus.PersonId.ToString();
         txtComercialName.Text = cus.FullName;
         // if a patient has been passed we can not touch it
         txtCustomerId.Enabled    = false;
         txtComercialName.Enabled = false;
         btnCustomerId.Visible    = false;
         LoadPolicyCombo(null);
     }
     else
     {
         LoadPolicyCombo(null);
         LoadClinicCombo(null);
     }
     if (Session["Clinic"] != null)
     {
         cl = (Clinic)Session["Clinic"];
     }
     //
     if (Request.QueryString["ServiceNoteId"] != null)
     {
         serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
         sn            = CntAriCli.GetServiceNote(serviceNoteId, ctx);
         // disable select fields
         cus = sn.Customer;
         txtCustomerId.Text    = cus.PersonId.ToString(); txtCustomerId.Enabled = false;
         txtComercialName.Text = cus.FullName; txtComercialName.Enabled = false;
         cl   = sn.Clinic;
         prof = sn.Professional;
         if (prof != null)
         {
             txtProfessionalId.Text   = prof.PersonId.ToString(); txtProfessionalId.Enabled = false;
             txtProfessionalName.Text = prof.FullName; txtProfessionalName.Enabled = false;
         }
         rddpTicketDate.SelectedDate = sn.ServiceNoteDate;
     }
     //
     if (Request.QueryString["TicketId"] != null)
     {
         ticketId   = Int32.Parse(Request.QueryString["TicketId"]);
         tck        = CntAriCli.GetTicket(ticketId, ctx);
         cus        = tck.Policy.Customer;
         customerId = cus.PersonId;
         if (tck.ServiceNote != null)
         {
             sn            = tck.ServiceNote;
             serviceNoteId = sn.ServiceNoteId;
         }
         LoadData(tck);
     }
     else
     {
         // If there isn't a ticket the default date must be today
         rddpTicketDate.SelectedDate = DateTime.Now;
         if (sn != null)
         {
             rddpTicketDate.SelectedDate = sn.ServiceNoteDate;
         }
         LoadPolicyCombo(null);
         LoadClinicCombo(null);
     }
 }
Beispiel #14
0
		///<summary>Updates one Clinic in the database.</summary>
		public static void Update(Clinic clinic){
			string command="UPDATE clinic SET "
				+"Description        = '"+POut.String(clinic.Description)+"', "
				+"Address            = '"+POut.String(clinic.Address)+"', "
				+"Address2           = '"+POut.String(clinic.Address2)+"', "
				+"City               = '"+POut.String(clinic.City)+"', "
				+"State              = '"+POut.String(clinic.State)+"', "
				+"Zip                = '"+POut.String(clinic.Zip)+"', "
				+"Phone              = '"+POut.String(clinic.Phone)+"', "
				+"BankNumber         = '"+POut.String(clinic.BankNumber)+"', "
				+"DefaultPlaceService=  "+POut.Int   ((int)clinic.DefaultPlaceService)+", "
				+"InsBillingProv     =  "+POut.Long  (clinic.InsBillingProv)+", "
				+"Fax                = '"+POut.String(clinic.Fax)+"', "
				+"EmailAddressNum    =  "+POut.Long  (clinic.EmailAddressNum)+", "
				+"DefaultProv        =  "+POut.Long  (clinic.DefaultProv)+", "
				+"SmsContractDate    =  "+POut.DateT (clinic.SmsContractDate)+", "
				+"SmsContractName    = '"+POut.String(clinic.SmsContractName)+"' "
				+"WHERE ClinicNum = "+POut.Long(clinic.ClinicNum);
			Db.NonQ(command);
		}
Beispiel #15
0
 /// <summary>
 /// As its name suggest if there isn't an object
 /// it'll create it. It exists modify it.
 /// </summary>
 /// <returns></returns>
 protected bool CreateChange()
 {
     if (!DataOk())
         return false;
     if (clinicId == 0)
     {
         cl = new Clinic();
         UnloadData(cl);
         ctx.Add(cl);
     }
     else
     {
         cl = (from c in ctx.Clinics
               where c.ClinicId == clinicId
               select c).FirstOrDefault<Clinic>();
         UnloadData(cl);
     }
     ctx.SaveChanges();
     return true;
 }
Beispiel #16
0
    public string Update_Provider(ProviderInfo ProvInfo, Clinic clinic,string userID)
    {
        string msg = "";
        SqlConnection sqlCon = new SqlConnection(ConStr);
        SqlCommand sqlCmd = new SqlCommand("sp_update_Provider_Details", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter P_ID = sqlCmd.Parameters.Add("@Prov_ID", SqlDbType.Int);
        P_ID.Value = ProvInfo.Prov_ID;

        SqlParameter P_MName = sqlCmd.Parameters.Add("@Prov_MName", SqlDbType.VarChar, 2);
        if (ProvInfo.MiddleName != null)
            P_MName.Value = ProvInfo.MiddleName;
        else
            P_MName.Value = Convert.DBNull;

        SqlParameter P_Spec = sqlCmd.Parameters.Add("@Prov_Speciality", SqlDbType.VarChar, 25);
        if (ProvInfo.Speciality != null)
            P_Spec.Value = ProvInfo.Speciality;
        else
            P_Spec.Value = Convert.DBNull;

        SqlParameter P_Degree = sqlCmd.Parameters.Add("@Prov_Degree", SqlDbType.VarChar, 50);
        if (ProvInfo.Degree != null)
            P_Degree.Value = ProvInfo.Degree;
        else
            P_Degree.Value = Convert.DBNull;
        SqlParameter P_DeaNo = sqlCmd.Parameters.Add("@Prov_DeaNo", SqlDbType.VarChar, 50);
        if (ProvInfo.DeaNumber != null)
            P_DeaNo.Value = ProvInfo.DeaNumber;
        else
            P_DeaNo.Value = Convert.DBNull;

        SqlParameter P_Location = sqlCmd.Parameters.Add("@Prov_Location", SqlDbType.VarChar, 50);
        if (ProvInfo.Location != null)
            P_Location.Value = ProvInfo.Location;
        else
            P_Location.Value = Convert.DBNull;

        SqlParameter P_Address1 = sqlCmd.Parameters.Add("@Prov_Address1", SqlDbType.VarChar, 50);
        if (ProvInfo.Address1 != null)
            P_Address1.Value = ProvInfo.Address1;
        else
            P_Address1.Value = Convert.DBNull;

        SqlParameter P_Address2 = sqlCmd.Parameters.Add("@Prov_Address2", SqlDbType.VarChar, 50);
        if (ProvInfo.Address2 != null)
            P_Address2.Value = ProvInfo.Address2;
        else
            P_Address2.Value = Convert.DBNull;

        SqlParameter P_City = sqlCmd.Parameters.Add("@Prov_City", SqlDbType.VarChar, 50);
        if (ProvInfo.City != null)
            P_City.Value = ProvInfo.City;
        else
            P_City.Value = Convert.DBNull;

        SqlParameter P_State = sqlCmd.Parameters.Add("@Prov_State", SqlDbType.VarChar, 50);
        if (ProvInfo.State != null)
            P_State.Value = ProvInfo.State;
        else
            P_State.Value = Convert.DBNull;
        SqlParameter P_ZIP = sqlCmd.Parameters.Add("@Prov_Zip", SqlDbType.VarChar, 50);
        if (ProvInfo.Zip != null)
            P_ZIP.Value = ProvInfo.Zip;
        else
            P_ZIP.Value = Convert.DBNull;

        SqlParameter P_HPhone = sqlCmd.Parameters.Add("@Prov_HPhone", SqlDbType.VarChar, 50);
        if (ProvInfo.HPhone != null)
            P_HPhone.Value = ProvInfo.HPhone;
        else
            P_HPhone.Value = Convert.DBNull;

        SqlParameter P_CPhone = sqlCmd.Parameters.Add("@Prov_CPhone", SqlDbType.VarChar, 50);
        if (ProvInfo.CPhone != null)
            P_CPhone.Value = ProvInfo.CPhone;
        else
            P_CPhone.Value = Convert.DBNull;
        SqlParameter P_EMail = sqlCmd.Parameters.Add("@Prov_EMail", SqlDbType.VarChar, 50);
        if (ProvInfo.EMail != null)
            P_EMail.Value = ProvInfo.EMail;
        else
            P_EMail.Value = Convert.DBNull;

        SqlParameter P_Fax = sqlCmd.Parameters.Add("@Prov_Fax", SqlDbType.VarChar, 50);
        if (ProvInfo.Fax != null)
            P_Fax.Value = ProvInfo.Fax;
        else
            P_Fax.Value = Convert.DBNull;

        SqlParameter P_LICNo = sqlCmd.Parameters.Add("@Prov_LICNo", SqlDbType.VarChar, 50);
        if (ProvInfo.LicNo != null)
            P_LICNo.Value = ProvInfo.LicNo;
        else
            P_LICNo.Value = Convert.DBNull;

        SqlParameter P_Status = sqlCmd.Parameters.Add("@Prov_Status", SqlDbType.VarChar, 50);
        if (ProvInfo.Status != null)
            P_Status.Value = ProvInfo.Status;
        else
            P_Status.Value = Convert.DBNull;

        SqlParameter ClinicID = sqlCmd.Parameters.Add("@ClinicID", SqlDbType.Int);
        if (clinic.ClinicID != null)
            ClinicID.Value = clinic.ClinicID;
        else
            ClinicID.Value = Convert.DBNull;

        SqlParameter P_NPI = sqlCmd.Parameters.Add("@Prov_NPI", SqlDbType.VarChar, 50);
        if (ProvInfo.NPI != null)
            P_NPI.Value = ProvInfo.NPI;
        else
            P_NPI.Value = Convert.DBNull;

        SqlParameter P_Sign = sqlCmd.Parameters.Add("@Prov_Sign", SqlDbType.Image);
        if (ProvInfo.Signature != null)
            P_Sign.Value = ProvInfo.Signature;
        else
            P_Sign.Value = Convert.DBNull;

        SqlParameter P_Type = sqlCmd.Parameters.Add("@Prov_Type", SqlDbType.Char);
        P_Type.Value = ProvInfo.UserType;

         SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar,20);
         pUserID.Value =userID;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
            msg = "Updated Provider Information Successfully";
        }
        catch (SqlException SqlEx)
        {
            objNLog.Error("SQLException : " + SqlEx.Message);
            throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Updaing Provider Info.", SqlEx);
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            throw new Exception("**Error occured while Updaing Provider Info.", ex);
        }
        finally
        {
            sqlCon.Close();
        }

        return msg;
    }
Beispiel #17
0
        public ActionResult TruncateDB()
        {
            //      _db.ExecuteCommand("TRUNCATE TABLE Entity");

            _db.AppointmentTimeSlot.RemoveRange(_db.AppointmentTimeSlot);
            _db.Appointment.RemoveRange(_db.Appointment);
            _db.Pet.RemoveRange(_db.Pet);
            _db.Specie.RemoveRange(_db.Specie);
            _db.Member.RemoveRange(_db.Member);
            _db.TimeSlot.RemoveRange(_db.TimeSlot);
            _db.SaveChanges();

            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('Appointment', RESEED, 0)");
            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('AppointmentTimeSlot', RESEED, 0)");
            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('Pet', RESEED, 0)");
            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('Specie', RESEED, 0)");
            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('Member', RESEED, 0)");
            _db.Database.ExecuteSqlCommand("DBCC CHECKIDENT('TimeSlot', RESEED, 0)");



            //   DateTime current = DateTime.Now;
            // int day = DateTime.Now.Day;
            //  DateTime year;

            TimeSpan start = new TimeSpan(09, 30, 0);
            TimeSpan end   = new TimeSpan(21, 00, 0);

            //Start from monday -> sunday

            DateTime today = new DateTime(2017, 11, 15);

            // lastMonday is always the Monday before nextSunday.
            // When date is a Sunday, lastMonday will be tomorrow.
            int      offset     = today.DayOfWeek - DayOfWeek.Monday;
            DateTime lastMonday = today.AddDays(-offset);
            DateTime endWeek    = lastMonday.AddDays(6);


            //  var monday = today.AddDays(-(int)DateTime.Today.DayOfWeek + (int)DayOfWeek.Monday);
            //Loop for this week
            while (lastMonday <= endWeek)
            {
                //Start from monday -> sunday

                DateTime dt = new DateTime(lastMonday.Year, lastMonday.Month, lastMonday.Day);
                //Loop for hour in day

                DateTime startTime = new DateTime(dt.Year, dt.Month, dt.Day) + start;
                DateTime endTime   = new DateTime(dt.Year, dt.Month, dt.Day) + end;
                var      hours     = new List <DateTime>();
                hours.Add(startTime);
                var next = new DateTime(startTime.Year, startTime.Month, startTime.Day,
                                        startTime.Hour, startTime.Minute, 0, startTime.Kind);

                while ((next = next.AddHours(0.5)) < endTime)
                {
                    hours.Add(next);
                }
                hours.Add(endTime);

                foreach (var hour in hours)
                {
                    TimeSlot timeblock = new TimeSlot();
                    timeblock.startTime    = hour;
                    timeblock.endTime      = hour.AddHours(0.5);
                    timeblock.numberofCase = 0;
                    timeblock.status       = "Free";
                    TimeSlotService.Add(timeblock);
                    var check = timeblock.id;
                }
                lastMonday = lastMonday.AddDays(1);
            }



            // Add member
            List <Member> members = new List <Member>()
            {
                new Member {
                    email = "*****@*****.**", password = "******", name = "one", surname = "someone", address = "t1 address", phonenumber = "0950828781"
                },
                new Member {
                    email = "*****@*****.**", password = "******", name = "two", surname = "tomorrow", address = "t2 address", phonenumber = "0222222222"
                },
                new Member {
                    email = "*****@*****.**", password = "******", name = "three", surname = "teatime", address = "t3 home", phonenumber = "0333333333"
                },
            };

            foreach (Member member in members)
            {
                MemberService.Add(member);
            }


            // Add type
            List <Specie> types = new List <Specie>()
            {
                new Specie {
                    name = "cat"
                },
                new Specie {
                    name = "dog"
                },
                new Specie {
                    name = "rabbit"
                },
                new Specie {
                    name = "fish"
                }
            };

            foreach (Specie type in types)
            {
                SpecieService.Add(type);
            }


            /* // Add type
             * List<VAService> services = new List<VAService>()
             * {
             *   new VAService {description ="Vaccination"},
             *   new VAService {description ="Health check"},
             *   new VAService {description ="Fllow up"},
             *   new VAService {description ="Surgery"},
             * };
             * foreach (VAService service in services)
             * {
             *   VAService.Add(service);
             * }*/

            // Add pet
            List <Pet> pets = new List <Pet>()
            {
                new Pet {
                    memberId = 1, name = "oneDog", specieId = 2
                },
                new Pet {
                    memberId = 1, name = "oneCat", specieId = 1
                },
                new Pet {
                    memberId = 2, name = "twoRabbit", specieId = 3
                },
            };

            foreach (Pet pet in pets)
            {
                PetService.Add(pet);
            }

            //Update clinic
            Clinic clinic = VCService.Get();

            clinic.maximumCase = 2;
            VCService.Update(clinic);

            // Add appointment
            //date for 7 aug
            TimeSlot a = TimeSlotService.GetByID(1);
            TimeSlot b = TimeSlotService.GetByID(2);
            TimeSlot c = TimeSlotService.GetByID(8);
            //
            TimeSlot d = TimeSlotService.GetByID(9);
            TimeSlot e = TimeSlotService.GetByID(10);
            //
            TimeSlot f = TimeSlotService.GetByID(11);
            TimeSlot g = TimeSlotService.GetByID(14);
            TimeSlot h = TimeSlotService.GetByID(26);

            List <Appointment> appointments = new List <Appointment>()
            {
                new Appointment {
                    memberId   = 1, petId = 2, serviceId = 1, detail = "Rabies vaccine",
                    suggestion = "",
                    startTime  = a.startTime, endTime = a.endTime, status = "Complete"
                },
                new Appointment {
                    memberId   = 2, petId = 3, serviceId = 2, detail = "",
                    suggestion = "",
                    startTime  = a.startTime, endTime = b.endTime, status = "Complete"
                },
                new Appointment {
                    memberId   = 1, petId = 1, serviceId = 4, detail = "Sterilization",
                    suggestion = "Stop drinking and eating 4 hour before come to the clinic",
                    startTime  = c.startTime, endTime = f.endTime, status = "Waiting"
                },
                new Appointment {
                    memberId   = 2, petId = 3, serviceId = 3, detail = "",
                    suggestion = "",
                    startTime  = g.startTime, endTime = g.endTime, status = "Waiting"
                },
                new Appointment {
                    memberId   = 2, petId = 3, serviceId = 4, detail = "",
                    suggestion = "",
                    startTime  = h.startTime, endTime = h.endTime, status = "Waiting"
                }
            };

            foreach (Appointment appointment in appointments)
            {
                AppointmentService.Add(appointment);
            }

            // Update timeslot's number of case and status
            a.numberofCase = 2;
            a.status       = "Busy";
            b.numberofCase = 1;
            c.numberofCase = 1;
            c.status       = "Full";
            d.numberofCase = 1;
            d.status       = "Full";
            e.numberofCase = 1;
            e.status       = "Full";
            f.numberofCase = 1;
            f.status       = "Full";
            g.numberofCase = 1;
            h.numberofCase = 1;
            h.status       = "Full";
            TimeSlotService.Update(a);
            TimeSlotService.Update(b);
            TimeSlotService.Update(c);
            TimeSlotService.Update(d);
            TimeSlotService.Update(e);
            TimeSlotService.Update(f);
            TimeSlotService.Update(g);
            TimeSlotService.Update(h);



            //AppointmentTimeSlot

            // Add pet
            List <AppointmentTimeSlot> apptimes = new List <AppointmentTimeSlot>()
            {
                new AppointmentTimeSlot {
                    timeId = 1, appointmentID = 1
                },
                new AppointmentTimeSlot {
                    timeId = 1, appointmentID = 2
                },
                new AppointmentTimeSlot {
                    timeId = 2, appointmentID = 2
                },
                new AppointmentTimeSlot {
                    timeId = 8, appointmentID = 3
                },
                new AppointmentTimeSlot {
                    timeId = 9, appointmentID = 3
                },
                new AppointmentTimeSlot {
                    timeId = 10, appointmentID = 3
                },
                new AppointmentTimeSlot {
                    timeId = 11, appointmentID = 3
                },
                new AppointmentTimeSlot {
                    timeId = 14, appointmentID = 4
                },
                new AppointmentTimeSlot {
                    timeId = 26, appointmentID = 5
                }
            };

            foreach (AppointmentTimeSlot app in apptimes)
            {
                AppTimeService.Add(app);
            }
            return(Json(new { Result = "Success" }));
        }
Beispiel #18
0
    private static void ReleasePetFromClinic(string clinicName)
    {
        Clinic currentClinic = allClinics[clinicName];

        Console.WriteLine(currentClinic.TryReleasePet());
    }
Beispiel #19
0
        public bool ReleasePet(string clinicName)
        {
            Clinic clinic = GetClinic(clinicName);

            return(clinic.Release());
        }
        private void FormBillingDefaults_Load(object sender, EventArgs e)
        {
            textDays.Text                  = PrefC.GetLong(PrefName.BillingDefaultsLastDays).ToString();
            checkIntermingled.Checked      = PrefC.GetBool(PrefName.BillingDefaultsIntermingle);
            checkSinglePatient.Checked     = PrefC.GetBool(PrefName.BillingDefaultsSinglePatient);
            textNote.Text                  = PrefC.GetString(PrefName.BillingDefaultsNote);
            checkCreatePDF.Checked         = PrefC.GetBool(PrefName.BillingElectCreatePDF);
            listElectBilling.SelectedIndex = 0;
            int billingUseElectronicIdx = PrefC.GetInt(PrefName.BillingUseElectronic);

            if (billingUseElectronicIdx == 1)
            {
                listElectBilling.SelectedIndex = 1;
                checkCreatePDF.Enabled         = true;
                labelBlankForDefault.Visible   = true;
            }
            if (billingUseElectronicIdx == 2)
            {
                listElectBilling.SelectedIndex = 2;
            }
            if (billingUseElectronicIdx == 3)
            {
                checkCreatePDF.Enabled         = true;
                listElectBilling.SelectedIndex = 3;
            }
            if (billingUseElectronicIdx == 4)
            {
                listElectBilling.SelectedIndex = 4;
            }
            arrayOutputPaths[0]    = "";       //Will never be used, but is helpful to keep the indexes of arrayOutputPaths aligned with the options listed in listElectBilling.
            arrayOutputPaths[1]    = PrefC.GetString(PrefName.BillingElectStmtUploadURL);
            arrayOutputPaths[2]    = PrefC.GetString(PrefName.BillingElectStmtOutputPathPos);
            arrayOutputPaths[3]    = PrefC.GetString(PrefName.BillingElectStmtOutputPathClaimX);
            arrayOutputPaths[4]    = PrefC.GetString(PrefName.BillingElectStmtOutputPathEds);
            textStatementURL.Text  = arrayOutputPaths[billingUseElectronicIdx];
            textVendorId.Text      = PrefC.GetString(PrefName.BillingElectVendorId);
            textVendorPMScode.Text = PrefC.GetString(PrefName.BillingElectVendorPMSCode);
            string cc = PrefC.GetString(PrefName.BillingElectCreditCardChoices);

            if (cc.Contains("MC"))
            {
                checkMC.Checked = true;
            }
            if (cc.Contains("V"))
            {
                checkV.Checked = true;
            }
            if (cc.Contains("D"))
            {
                checkD.Checked = true;
            }
            if (cc.Contains("A"))
            {
                checkAmEx.Checked = true;
            }
            textBillingEmailSubject.Text = PrefC.GetString(PrefName.BillingEmailSubject);
            textBillingEmailBody.Text    = PrefC.GetString(PrefName.BillingEmailBodyText);
            textInvoiceNote.Text         = PrefC.GetString(PrefName.BillingDefaultsInvoiceNote);
            _listEbills    = Ebills.GetDeepCopy();
            _listEbillsOld = _listEbills.Select(x => x.Copy()).ToList();
            //Find the default Ebill
            for (int i = 0; i < _listEbills.Count; i++)
            {
                if (_listEbills[i].ClinicNum == 0)
                {
                    _eBillDefault = _listEbills[i];
                }
            }
            if (_eBillDefault == null)
            {
                MsgBox.Show(this, "The default ebill entry is missing. Run " + nameof(DatabaseMaintenances.EbillMissingDefaultEntry)
                            + " in the Database Maintenance Tool before continuing.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            _eBillCur = _eBillDefault;
            //Set the textboxes to default values.
            textClientAcctNumber.Text = _eBillDefault.ClientAcctNumber;
            textUserName.Text         = _eBillDefault.ElectUserName;
            textPassword.Text         = _eBillDefault.ElectPassword;
            string[] arrayEbillAddressEnums = Enum.GetNames(typeof(EbillAddress));
            for (int i = 0; i < arrayEbillAddressEnums.Length; i++)
            {
                comboPracticeAddr.Items.Add(arrayEbillAddressEnums[i]);
                comboRemitAddr.Items.Add(arrayEbillAddressEnums[i]);
                //If clinics are off don't add the Clinic specific EbillAddress enums
                if (!PrefC.HasClinicsEnabled && i == 2)
                {
                    break;
                }
            }
            if (PrefC.HasClinicsEnabled)
            {
                comboClinic.Visible = true;
                labelClinic.Visible = true;
                //Bold clinic specific fields.
                groupBoxBilling.Text   = Lan.g(this, "Electronic Billing - Bolded fields are clinic specific");
                labelAcctNum.Font      = new Font(labelAcctNum.Font, FontStyle.Bold);
                labelUserName.Font     = new Font(labelUserName.Font, FontStyle.Bold);
                labelPassword.Font     = new Font(labelPassword.Font, FontStyle.Bold);
                labelClinic.Font       = new Font(labelClinic.Font, FontStyle.Bold);
                labelPracticeAddr.Font = new Font(labelPracticeAddr.Font, FontStyle.Bold);
                labelRemitAddr.Font    = new Font(labelRemitAddr.Font, FontStyle.Bold);
                comboClinic.Items.Clear();
                _listClinics = new List <Clinic>();
                //Add "Unassigned/Default" option if the user isn't restricted or the selected clinic is 0.
                if (!Security.CurUser.ClinicIsRestricted || Clinics.ClinicNum == 0)
                {
                    Clinic clinicUnassigned = new Clinic();
                    clinicUnassigned.ClinicNum = 0;
                    clinicUnassigned.Abbr      = Lan.g(this, "Unassigned/Default");
                    _listClinics.Add(clinicUnassigned);
                }
                _listClinics.AddRange(Clinics.GetForUserod(Security.CurUser));
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    comboClinic.Items.Add(_listClinics[i].Abbr);
                    //If the clinic we're adding is the one currently selected in OD, attempt to find its Ebill entry.
                    if (_listClinics[i].ClinicNum == Clinics.ClinicNum)
                    {
                        comboClinic.SelectedIndex = i;
                        Ebill eBill = null;
                        if (Clinics.ClinicNum == 0)                       //Use the default Ebill if OD has Headquarters selected or if clinics are disabled.
                        {
                            eBill = _eBillDefault;
                        }
                        else
                        {
                            eBill = _listEbills.FirstOrDefault(x => x.ClinicNum == _listClinics[i].ClinicNum);                        //Can be null.
                        }
                        //_eBillCur will be the default Ebill, the clinic's Ebill, or null if there are no existing ebills for OD's selected clinic.
                        _eBillCur = eBill;
                    }
                }
            }
            listModesToText.Items.Clear();
            foreach (StatementMode stateMode in Enum.GetValues(typeof(StatementMode)))
            {
                listModesToText.Items.Add(new ODBoxItem <StatementMode>(Lan.g("enumStatementMode", stateMode.GetDescription()), stateMode));
            }
            foreach (string modeIdx in PrefC.GetString(PrefName.BillingDefaultsModesToText)
                     .Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
            {
                listModesToText.SetSelected(PIn.Int(modeIdx), true);
            }
            textSmsTemplate.Text = PrefC.GetString(PrefName.BillingDefaultsSmsTemplate);
            //Load _eBillCur's fields into the UI.
            LoadEbill(_eBillCur);
        }
Beispiel #21
0
    private static void CheckForEmptyRooms(string clinicName)
    {
        Clinic currentClinic = allClinics[clinicName];

        Console.WriteLine(currentClinic.HasEmptyRooms());
    }
Beispiel #22
0
    public static void Main()
    {
        List <Clinic> clinics = new List <Clinic>();
        List <Pet>    pets    = new List <Pet>();

        int n = int.Parse(Console.ReadLine());

        for (int i = 0; i < n; i++)
        {
            string[] command = Console.ReadLine().Split().ToArray();

            switch (command[0])
            {
            case "Create":
                if (command[1] == "Pet")
                {
                    Pet p = new Pet(command[2], int.Parse(command[3]), command[4]);
                    pets.Add(p);
                }
                else if (command[1] == "Clinic")
                {
                    try
                    {
                        Clinic c = new Clinic(command[2], int.Parse(command[3]));
                        clinics.Add(c);
                    }
                    catch (ArgumentException e)
                    {
                        Console.WriteLine("Invalid Operation!");
                    }
                }

                break;

            case "Add":

                Pet    pet    = pets.FirstOrDefault(x => x.Name == command[1]);
                Clinic clinic = clinics.FirstOrDefault(x => x.Name == command[2]);

                Console.WriteLine(clinic?.Add(pet));

                break;

            case "Release":

                Console.WriteLine(clinics.FirstOrDefault(x => x.Name == command[1])?.Release());

                break;

            case "HasEmptyRooms":

                Console.WriteLine(clinics.FirstOrDefault(x => x.Name == command[1])?.HasEmptyRooms());
                break;

            case "Print":

                if (command.Length == 3)
                {
                    Console.WriteLine(clinics.FirstOrDefault(x => x.Name == command[1])?.PrintRoom(int.Parse(command[2]) - 1));
                }
                else
                {
                    Console.WriteLine(clinics.FirstOrDefault(x => x.Name == command[1])?.Print());
                }

                break;
            }
        }
    }
 partial void DeleteClinic(Clinic instance);
 partial void UpdateClinic(Clinic instance);
 partial void InsertClinic(Clinic instance);
Beispiel #26
0
        public bool DoesHaveEmptyRooms(string clinicName)
        {
            Clinic clinic = GetClinic(clinicName);

            return(clinic.HasEmptyRooms());
        }
 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);
     }
     if (Session["Clinic"] != null)
         cl = (Clinic)Session["Clinic"];
     // 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;
     }
     else if (type == "comprobante")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("Actions");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         //RadGrid1.Columns.FindByDataField("Policy.Customer.FullName").Visible = false;
         btnComp.Visible = true;
         
         lblTitle.Text = "Comprobantes";
         
         rdcbType.AutoPostBack = true;
         rdcbType.Items.Clear();
         rdcbType.Items.Add(new RadComboBoxItem("Con comprobante", "C"));
         rdcbType.Items.Add(new RadComboBoxItem("Sin comprobante", "SC"));
         
         RadGrid1.PageSize = 6;
     }
     else
     {
         //
         RadGrid1.PageSize = 6;
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
     //
     LoadInsuranceCombo();
     LoadPayementFormCombo();
     LoadClinicCombo();
 }
Beispiel #28
0
        public void Print(string clinicName)
        {
            Clinic clinic = GetClinic(clinicName);

            Console.WriteLine(clinic);
        }
Beispiel #29
0
        private void FillGridObservations()
        {
            gridObservations.BeginUpdate();
            gridObservations.Columns.Clear();
            gridObservations.Columns.Add(new UI.ODGridColumn("Observation", 200));   //0
            gridObservations.Columns.Add(new UI.ODGridColumn("Value Type", 200));    //1
            gridObservations.Columns.Add(new UI.ODGridColumn("Value", 0));           //2
            gridObservations.Rows.Clear();
            List <EhrAptObs> listEhrAptObses = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listEhrAptObses.Count; i++)
            {
                EhrAptObs    obs = listEhrAptObses[i];
                UI.ODGridRow row = new UI.ODGridRow();
                row.Tag = obs;
                row.Cells.Add(obs.IdentifyingCode.ToString());                //0 Observation
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    row.Cells.Add(obs.ValType.ToString() + " - " + obs.ValCodeSystem);                //1 Value Type
                    if (obs.ValCodeSystem == "LOINC")
                    {
                        Loinc loincValue = Loincs.GetByCode(obs.ValReported);
                        row.Cells.Add(loincValue.NameShort);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "SNOMEDCT")
                    {
                        Snomed snomedValue = Snomeds.GetByCode(obs.ValReported);
                        row.Cells.Add(snomedValue.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD9")
                    {
                        ICD9 icd9Value = ICD9s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd9Value.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD10")
                    {
                        Icd10 icd10Value = Icd10s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd10Value.Description);                        //2 Value
                    }
                }
                else if (obs.ValType == EhrAptObsType.Address)
                {
                    string sendingFacilityAddress1 = PrefC.GetString(PrefName.PracticeAddress);
                    string sendingFacilityAddress2 = PrefC.GetString(PrefName.PracticeAddress2);
                    string sendingFacilityCity     = PrefC.GetString(PrefName.PracticeCity);
                    string sendingFacilityState    = PrefC.GetString(PrefName.PracticeST);
                    string sendingFacilityZip      = PrefC.GetString(PrefName.PracticeZip);
                    if (!PrefC.GetBool(PrefName.EasyNoClinics) && _appt.ClinicNum != 0)                   //Using clinics and a clinic is assigned.
                    {
                        Clinic clinic = Clinics.GetClinic(_appt.ClinicNum);
                        sendingFacilityAddress1 = clinic.Address;
                        sendingFacilityAddress2 = clinic.Address2;
                        sendingFacilityCity     = clinic.City;
                        sendingFacilityState    = clinic.State;
                        sendingFacilityZip      = clinic.Zip;
                    }
                    row.Cells.Add(obs.ValType.ToString());                                                                                                                      //1 Value Type
                    row.Cells.Add(sendingFacilityAddress1 + " " + sendingFacilityAddress2 + " " + sendingFacilityCity + " " + sendingFacilityState + " " + sendingFacilityZip); //2 Value
                }
                else
                {
                    row.Cells.Add(obs.ValType.ToString());             //1 Value Type
                    row.Cells.Add(obs.ValReported);                    //2 Value
                }
                gridObservations.Rows.Add(row);
            }
            gridObservations.EndUpdate();
        }
Beispiel #30
0
        public void Doctors_DetailGrid()
        {
            //Arrange
            var cRepository = new Mock <IClinicRepository>();
            var controller  = new AdministrationController(cRepository.Object);
            var clinicId    = 111;
            var doctor1     = new User {
                Id        = 10,
                FirstName = "First10",
                LastName  = "Last10",
                Role      = "Doctor",
                Patients  = new List <Patient> {
                    new Patient()
                },
                Login = "******",
                Photo = new byte[] { 1, 2, 3 }
            };
            var doctor2 = new User {
                Id        = 20,
                FirstName = "First20",
                LastName  = "Last20",
                Role      = "Supervisor",
                Patients  = new List <Patient> {
                    new Patient(), new Patient()
                },
                Login = "******",
                Photo = new byte[] { 3, 4, 5 }
            };

            var clinic = new Clinic {
                Id = clinicId, Caption = "Clinic111", Doctors = new List <User> {
                    doctor1, doctor2
                }
            };

            cRepository.Setup(r => r.GetByKey(clinicId)).Returns(clinic);

            //Act
            var result = controller.ClinicDoctors(clinicId);

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result is PartialViewResult);
            var viewResultBase = result as ViewResultBase;

            Assert.That(viewResultBase.Model, Is.Not.Null);
            Assert.That(viewResultBase.ViewName, Is.EqualTo("_ClinicDoctorsGrid"));
            Assert.That(viewResultBase.Model is ClinicDetailsViewModel);
            var model = viewResultBase.Model as ClinicDetailsViewModel;

            Assert.That(model.Doctors, Is.Not.Null);
            Assert.That(model.Doctors.Count, Is.EqualTo(2));

            Assert.That(model.ClinicId, Is.EqualTo(111));

            Assert.That(model.Doctors[0].ClinicId, Is.EqualTo(111));
            Assert.That(model.Doctors[0].DoctorId, Is.EqualTo(10));
            Assert.That(model.Doctors[0].FirstName, Is.EqualTo("First10"));
            Assert.That(model.Doctors[0].LastName, Is.EqualTo("Last10"));
            Assert.That(model.Doctors[0].Role, Is.EqualTo("Doctor"));
            Assert.That(model.Doctors[0].PatientsCount, Is.EqualTo(1));
            Assert.That(model.Doctors[0].Login, Is.EqualTo("login10"));
            Assert.That(model.Doctors[0].Photo, Is.EqualTo(new byte[] { 1, 2, 3 }));

            Assert.That(model.Doctors[1].ClinicId, Is.EqualTo(111));
            Assert.That(model.Doctors[1].DoctorId, Is.EqualTo(20));
            Assert.That(model.Doctors[1].FirstName, Is.EqualTo("First20"));
            Assert.That(model.Doctors[1].LastName, Is.EqualTo("Last20"));
            Assert.That(model.Doctors[1].Role, Is.EqualTo("Supervisor"));
            Assert.That(model.Doctors[1].PatientsCount, Is.EqualTo(2));
            Assert.That(model.Doctors[1].Login, Is.EqualTo("login20"));
            Assert.That(model.Doctors[1].Photo, Is.EqualTo(new byte[] { 3, 4, 5 }));

            cRepository.Verify(r => r.GetByKey(clinicId), Times.Once());
        }
Beispiel #31
0
 public void UpdateClinic(Clinic newClinic)
 {
     this.clinic = newClinic;
 }
Beispiel #32
0
 private static void WriteAddress(XmlWriter writer, EbillAddress eBillAddress, Clinic clinic)
 {
     //If using practice information or using the default (no clinic) Ebill and a clinic enum is specified, use the practice level information.
     if (eBillAddress == EbillAddress.PracticePhysical || (clinic == null && eBillAddress == EbillAddress.ClinicPhysical))
     {
         writer.WriteElementString("Address1", PrefC.GetString(PrefName.PracticeAddress));
         writer.WriteElementString("Address2", PrefC.GetString(PrefName.PracticeAddress2));
         writer.WriteElementString("City", PrefC.GetString(PrefName.PracticeCity));
         writer.WriteElementString("State", PrefC.GetString(PrefName.PracticeST));
         writer.WriteElementString("Zip", PrefC.GetString(PrefName.PracticeZip));
         writer.WriteElementString("Phone", PrefC.GetString(PrefName.PracticePhone));               //enforced to be 10 digit fairly rigidly by the UI
     }
     else if (eBillAddress == EbillAddress.PracticePayTo || (clinic == null && eBillAddress == EbillAddress.ClinicPayTo))
     {
         writer.WriteElementString("Address1", PrefC.GetString(PrefName.PracticePayToAddress));
         writer.WriteElementString("Address2", PrefC.GetString(PrefName.PracticePayToAddress2));
         writer.WriteElementString("City", PrefC.GetString(PrefName.PracticePayToCity));
         writer.WriteElementString("State", PrefC.GetString(PrefName.PracticePayToST));
         writer.WriteElementString("Zip", PrefC.GetString(PrefName.PracticePayToZip));
         writer.WriteElementString("Phone", PrefC.GetString(PrefName.PracticePhone));               //enforced to be 10 digit fairly rigidly by the UI
     }
     else if (eBillAddress == EbillAddress.PracticeBilling || (clinic == null && eBillAddress == EbillAddress.ClinicBilling))
     {
         writer.WriteElementString("Address1", PrefC.GetString(PrefName.PracticeBillingAddress));
         writer.WriteElementString("Address2", PrefC.GetString(PrefName.PracticeBillingAddress2));
         writer.WriteElementString("City", PrefC.GetString(PrefName.PracticeBillingCity));
         writer.WriteElementString("State", PrefC.GetString(PrefName.PracticeBillingST));
         writer.WriteElementString("Zip", PrefC.GetString(PrefName.PracticeBillingZip));
         writer.WriteElementString("Phone", PrefC.GetString(PrefName.PracticePhone));               //enforced to be 10 digit fairly rigidly by the UI
     }
     else if (eBillAddress == EbillAddress.ClinicPhysical)
     {
         writer.WriteElementString("Address1", clinic.Address);
         writer.WriteElementString("Address2", clinic.Address2);
         writer.WriteElementString("City", clinic.City);
         writer.WriteElementString("State", clinic.State);
         writer.WriteElementString("Zip", clinic.Zip);
         writer.WriteElementString("Phone", clinic.Phone);               //enforced to be 10 digit fairly rigidly by the UI
     }
     else if (eBillAddress == EbillAddress.ClinicPayTo)
     {
         writer.WriteElementString("Address1", clinic.PayToAddress);
         writer.WriteElementString("Address2", clinic.PayToAddress2);
         writer.WriteElementString("City", clinic.PayToCity);
         writer.WriteElementString("State", clinic.PayToState);
         writer.WriteElementString("Zip", clinic.PayToZip);
         writer.WriteElementString("Phone", clinic.Phone);               //enforced to be 10 digit fairly rigidly by the UI
     }
     else if (eBillAddress == EbillAddress.ClinicBilling)
     {
         writer.WriteElementString("Address1", clinic.BillingAddress);
         writer.WriteElementString("Address2", clinic.BillingAddress2);
         writer.WriteElementString("City", clinic.BillingCity);
         writer.WriteElementString("State", clinic.BillingState);
         writer.WriteElementString("Zip", clinic.BillingZip);
         writer.WriteElementString("Phone", clinic.Phone);               //enforced to be 10 digit fairly rigidly by the UI
     }
 }
Beispiel #33
0
		///<summary>Updates one Clinic in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(Clinic clinic,Clinic oldClinic){
			string command="";
			if(clinic.Description != oldClinic.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(clinic.Description)+"'";
			}
			if(clinic.Address != oldClinic.Address) {
				if(command!=""){ command+=",";}
				command+="Address = '"+POut.String(clinic.Address)+"'";
			}
			if(clinic.Address2 != oldClinic.Address2) {
				if(command!=""){ command+=",";}
				command+="Address2 = '"+POut.String(clinic.Address2)+"'";
			}
			if(clinic.City != oldClinic.City) {
				if(command!=""){ command+=",";}
				command+="City = '"+POut.String(clinic.City)+"'";
			}
			if(clinic.State != oldClinic.State) {
				if(command!=""){ command+=",";}
				command+="State = '"+POut.String(clinic.State)+"'";
			}
			if(clinic.Zip != oldClinic.Zip) {
				if(command!=""){ command+=",";}
				command+="Zip = '"+POut.String(clinic.Zip)+"'";
			}
			if(clinic.Phone != oldClinic.Phone) {
				if(command!=""){ command+=",";}
				command+="Phone = '"+POut.String(clinic.Phone)+"'";
			}
			if(clinic.BankNumber != oldClinic.BankNumber) {
				if(command!=""){ command+=",";}
				command+="BankNumber = '"+POut.String(clinic.BankNumber)+"'";
			}
			if(clinic.DefaultPlaceService != oldClinic.DefaultPlaceService) {
				if(command!=""){ command+=",";}
				command+="DefaultPlaceService = "+POut.Int   ((int)clinic.DefaultPlaceService)+"";
			}
			if(clinic.InsBillingProv != oldClinic.InsBillingProv) {
				if(command!=""){ command+=",";}
				command+="InsBillingProv = "+POut.Long(clinic.InsBillingProv)+"";
			}
			if(clinic.Fax != oldClinic.Fax) {
				if(command!=""){ command+=",";}
				command+="Fax = '"+POut.String(clinic.Fax)+"'";
			}
			if(clinic.EmailAddressNum != oldClinic.EmailAddressNum) {
				if(command!=""){ command+=",";}
				command+="EmailAddressNum = "+POut.Long(clinic.EmailAddressNum)+"";
			}
			if(clinic.DefaultProv != oldClinic.DefaultProv) {
				if(command!=""){ command+=",";}
				command+="DefaultProv = "+POut.Long(clinic.DefaultProv)+"";
			}
			if(clinic.SmsContractDate != oldClinic.SmsContractDate) {
				if(command!=""){ command+=",";}
				command+="SmsContractDate = "+POut.DateT(clinic.SmsContractDate)+"";
			}
			if(clinic.SmsContractName != oldClinic.SmsContractName) {
				if(command!=""){ command+=",";}
				command+="SmsContractName = '"+POut.String(clinic.SmsContractName)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE clinic SET "+command
				+" WHERE ClinicNum = "+POut.Long(clinic.ClinicNum);
			Db.NonQ(command);
			return true;
		}
Beispiel #34
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);
     }
     //
     if (Request.QueryString["HcId"] != null)
     {
         hcId = Int32.Parse(Request.QueryString["HcId"]);
         hc = CntAriCli.GetHealthCompany(ctx);
         txtCaller.Text = hc.Name;
     }
     //
     if (Request.QueryString["ClinicId"] != null)
     {
         clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
         cl = (from c in ctx.Clinics
               where c.ClinicId == clinicId
               select c).FirstOrDefault<Clinic>();
         txtCaller.Text = cl.Name;
     }
     //
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat = CntAriCli.GetPatient(patientId, ctx);
         txtCaller.Text = pat.FullName;
     }
     //
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
         txtCaller.Text = cus.FullName;
     }
     //
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof = CntAriCli.GetProfessional(professionalId, ctx);
         txtCaller.Text = prof.FullName;
     }
     // 
     if (Request.QueryString["EmailId"] != null)
     {
         emailId = Int32.Parse(Request.QueryString["EmailId"]);
         Email eml = (from t in ctx.Emails
                      where t.EmailId == emailId
                      select t).FirstOrDefault<Email>();
         LoadData(eml);
     }
     else
     {
         LoadTypeCombo(null);
     }
 }
Beispiel #35
0
        public static void Initialize(ApplicationDbContext context)
        {
            if (context.Country.Any())
            {
                return;
            }
            var countries = new Country[]
            {
                new Country {
                    Name = "Turkey", PhoneCode = 90
                },
                new Country {
                    Name = "Germany", PhoneCode = 1
                },
                new Country {
                    Name = "United State", PhoneCode = 43
                },
                new Country {
                    Name = "England", PhoneCode = 77
                },
            };

            context.Country.AddRange(countries);
            context.SaveChanges();


            var cities = new City[]
            {
                new City {
                    Name = "İstanbul", PlateCode = 34, PhoneCode = 212, CountryId = 1
                },
                new City {
                    Name = "Karabük", PlateCode = 78, PhoneCode = 370, CountryId = 1
                },
                new City {
                    Name = "Sakarya", PlateCode = 54, PhoneCode = 260, CountryId = 1
                },
                new City {
                    Name = "London", PlateCode = 22, PhoneCode = 326, CountryId = 4
                },
                new City {
                    Name = "Manchester", PlateCode = 29, PhoneCode = 3296, CountryId = 4
                },
                new City {
                    Name = "Koln", PlateCode = 2, PhoneCode = 123, CountryId = 2
                },
                new City {
                    Name = "Munich", PlateCode = 39, PhoneCode = 13, CountryId = 2
                },
                new City {
                    Name = "San Jose", PlateCode = 12, PhoneCode = 43, CountryId = 3
                },
                new City {
                    Name = "New York", PlateCode = 98, PhoneCode = 332, CountryId = 3
                },
            };

            context.City.AddRange(cities);
            context.SaveChanges();


            var districts = new District[]
            {
                new District {
                    Name = "Merkez", PhoneCode = 370, CityId = 2
                },
                new District {
                    Name = "Eskipazar", PhoneCode = 818, CityId = 2
                },
                new District {
                    Name = "Kadıköy", PhoneCode = 212, CityId = 1
                },
                new District {
                    Name = "Esenyurt", PhoneCode = 212, CityId = 1
                },
                new District {
                    Name = "Adapazarı", PhoneCode = 261, CityId = 3
                },
                new District {
                    Name = "Serdivan", PhoneCode = 262, CityId = 3
                },

                new District {
                    Name = "Acton", PhoneCode = 2122, CityId = 4
                },
                new District {
                    Name = "Balham", PhoneCode = 2331, CityId = 4
                },
                new District {
                    Name = "Salford", PhoneCode = 231, CityId = 5
                },
                new District {
                    Name = "Urmston", PhoneCode = 331, CityId = 5
                },

                new District {
                    Name = "Ehrenfeld", PhoneCode = 34, CityId = 6
                },
                new District {
                    Name = "Lindenthal", PhoneCode = 3, CityId = 6
                },
                new District {
                    Name = "Pullach", PhoneCode = 1, CityId = 7
                },
                new District {
                    Name = "Sauerlach", PhoneCode = 11, CityId = 7
                },

                new District {
                    Name = "Whitesand", PhoneCode = 21, CityId = 8
                },
                new District {
                    Name = "Calview", PhoneCode = 31, CityId = 8
                },
                new District {
                    Name = "1st", PhoneCode = 76, CityId = 9
                },
                new District {
                    Name = "2nd", PhoneCode = 78, CityId = 9
                },
            };

            context.District.AddRange(districts);
            context.SaveChanges();


            var hospitals = new Hospital[]
            {
                new Hospital {
                    Name = "Karabük Devlet Hastanesi", PhoneNumber = "23123123123", DistrictId = 1
                },
                new Hospital {
                    Name = "Eskipazar Devlet Hastanesi", PhoneNumber = "23123123123", DistrictId = 2
                },
                new Hospital {
                    Name = "Acıbadem Hastanesi", PhoneNumber = "23123123123", DistrictId = 3
                },
                new Hospital {
                    Name = "Esenyurt Devlet Hastanesi", PhoneNumber = "23123123123", DistrictId = 4
                },
                new Hospital {
                    Name = "Adapazarı Devlet Hastanesi", PhoneNumber = "23123123123", DistrictId = 5
                },
                new Hospital {
                    Name = "Serdivan Sabancı Hastanesi", PhoneNumber = "23123123123", DistrictId = 6
                },
                new Hospital {
                    Name = "San Jose of Hospital", PhoneNumber = "23123123123", DistrictId = 7
                },
                new Hospital {
                    Name = "Central Hospital", PhoneNumber = "23123123123", DistrictId = 8
                },
                new Hospital {
                    Name = "England Of Hospital", PhoneNumber = "23123123123", DistrictId = 9
                },
                new Hospital {
                    Name = "Soldiers Hospital", PhoneNumber = "23123123123", DistrictId = 10
                },
            };

            context.Hospital.AddRange(hospitals);
            context.SaveChanges();

            var clinics = new Clinic[]
            {
                new Clinic {
                    Name = "Cardiology"
                },
                new Clinic {
                    Name = "Denstistry"
                },
                new Clinic {
                    Name = "Dermatology"
                },
                new Clinic {
                    Name = "Ear,Nose And Throat"
                },
                new Clinic {
                    Name = "Gastroenterology"
                },
                new Clinic {
                    Name = "Gynecology and Obstetrics"
                },
                new Clinic {
                    Name = "Ophthalmology"
                },
                new Clinic {
                    Name = "Orthopedics"
                },
                new Clinic {
                    Name = "Physical Therapy"
                },
                new Clinic {
                    Name = "Podiatry"
                },
                new Clinic {
                    Name = "Urology"
                },
            };

            context.Clinic.AddRange(clinics);
            context.SaveChanges();

            var hospitalAndClinic = new HospitalAndClinic[]
            {
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 8
                },
                new HospitalAndClinic {
                    HospitalId = 1, ClinicId = 9
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 8
                },
                new HospitalAndClinic {
                    HospitalId = 2, ClinicId = 9
                },
                new HospitalAndClinic {
                    HospitalId = 3, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 3, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 3, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 3, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 3, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 4, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 4, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 4, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 4, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 4, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 5, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 6, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 7, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 8, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 9, ClinicId = 7
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 1
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 2
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 3
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 4
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 5
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 6
                },
                new HospitalAndClinic {
                    HospitalId = 10, ClinicId = 7
                },
            };

            context.HospitalAndClinic.AddRange(hospitalAndClinic);
            context.SaveChanges();

            var doctors = new Doctor[]
            {
                new Doctor {
                    FirstName = "Samet", LastName = "Ertaş", Adress = "Ataturk mahallesi", AdressCity = "Karabük", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "123123123", BirthDate = DateTime.Parse("06-06-1995"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.APositive, Branch = "Dentist", HospitalAndClinicId = 1
                },
                new Doctor {
                    FirstName = "Ali", LastName = "Ertaş", Adress = "Çankaya mahallesi", AdressCity = "Ankara", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "1231123131178923", BirthDate = DateTime.Parse("21-10-1988"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.APositive, Branch = "Cardiologist", HospitalAndClinicId = 2
                },
                new Doctor {
                    FirstName = "Elif", LastName = "Uçar", Adress = "Üstükar aşağı sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 4, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive, Branch = "Dermatologist", HospitalAndClinicId = 4
                },
            };

            context.Doctor.AddRange(doctors);
            context.SaveChanges();


            var employees = new Employee[]
            {
                new Employee {
                    FirstName = "Hamza", LastName = "Yurtal", Adress = "Ataturk mahallesi", AdressCity = "Karabük", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "123123123", BirthDate = DateTime.Parse("06-06-1995"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.APositive, Position = "CEO", HospitalAndClinicId = 1
                },
                new Employee {
                    FirstName = "Kemal", LastName = "Serttaş", Adress = "Çankaya mahallesi", AdressCity = "Ankara", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "1231123131178923", BirthDate = DateTime.Parse("21-10-1988"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.APositive, Position = "Nurse", HospitalAndClinicId = 2
                },
                new Employee {
                    FirstName = "Ugur", LastName = "Uçar", Adress = "Üstükar aşağı sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 4
                },
                new Employee {
                    FirstName = "Sena", LastName = "Hızlı", Adress = "bakıent yavuz sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 5
                },
                new Employee {
                    FirstName = "Burcu", LastName = "Köle", Adress = "Çankaya sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 2, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.ONegative, Position = "Nurse", HospitalAndClinicId = 4
                },
                new Employee {
                    FirstName = "Ceren", LastName = "Yavuz", Adress = "Bilkentli Sokak", AdressCity = "Sakarya", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ONegative, Position = "Nurse", HospitalAndClinicId = 7
                },
                new Employee {
                    FirstName = "Tuğçe", LastName = "Karatağ", Adress = "Safranbolu esentepe", AdressCity = "Ankara", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Dicorved, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 7
                },
                new Employee {
                    FirstName = "Aslı", LastName = "Ünal", Adress = "Kadıköy Yıldız sokak", AdressCity = "İzmir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Dicorved, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 8
                },
                new Employee {
                    FirstName = "Hilal", LastName = "Sezer", Adress = "İncek mahallesi", AdressCity = "İzmir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 2, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.BNegative, Position = "Nurse", HospitalAndClinicId = 11
                },
                new Employee {
                    FirstName = "Kader", LastName = "Yıldız", Adress = "Aşti sokak", AdressCity = "Eskişehir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 11
                },
                new Employee {
                    FirstName = "Hamza", LastName = "Sevgili", Adress = "Gürses sokak", AdressCity = "Karabük", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.BNegative, Position = "Nurse", HospitalAndClinicId = 12
                },
                new Employee {
                    FirstName = "Deniz", LastName = "Yıldırım", Adress = "Bayraktar sokak", AdressCity = "Zonguldak", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.ABPositive, Position = "Nurse", HospitalAndClinicId = 7
                },
            };

            context.Employees.AddRange(employees);
            context.SaveChanges();


            var patients = new Patient[]
            {
                new Patient {
                    FirstName = "Hamza", LastName = "Yurtal", Adress = "Ataturk mahallesi", AdressCity = "Karabük", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "123123123", BirthDate = DateTime.Parse("06-06-1995"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.APositive
                },
                new Patient {
                    FirstName = "Kemal", LastName = "Serttaş", Adress = "Çankaya mahallesi", AdressCity = "Ankara", MobileNumber = "13123123123", Nationality = 1, HomeTown = 2, IdentificationNumber = "1231123131178923", BirthDate = DateTime.Parse("21-10-1988"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.APositive
                },
                new Patient {
                    FirstName = "Ugur", LastName = "Uçar", Adress = "Üstükar aşağı sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive
                },
                new Patient {
                    FirstName = "Sena", LastName = "Hızlı", Adress = "bakıent yavuz sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive
                },
                new Patient {
                    FirstName = "Burcu", LastName = "Köle", Adress = "Çankaya sokak", AdressCity = "İstanbul", MobileNumber = "5435234234", Nationality = 1, HomeTown = 2, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.ONegative
                },
                new Patient {
                    FirstName = "Ceren", LastName = "Yavuz", Adress = "Bilkentli Sokak", AdressCity = "Sakarya", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ONegative
                },
                new Patient {
                    FirstName = "Tuğçe", LastName = "Karatağ", Adress = "Safranbolu esentepe", AdressCity = "Ankara", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Dicorved, BloodType = Models.Enums.BloodType.ABPositive
                },
                new Patient {
                    FirstName = "Aslı", LastName = "Ünal", Adress = "Kadıköy Yıldız sokak", AdressCity = "İzmir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Dicorved, BloodType = Models.Enums.BloodType.ABPositive
                },
                new Patient {
                    FirstName = "Hilal", LastName = "Sezer", Adress = "İncek mahallesi", AdressCity = "İzmir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 2, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.BNegative
                },
                new Patient {
                    FirstName = "Kader", LastName = "Yıldız", Adress = "Aşti sokak", AdressCity = "Eskişehir", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Female, MaritalStatu = Models.Enums.MaritalStatu.Single, BloodType = Models.Enums.BloodType.ABPositive
                },
                new Patient {
                    FirstName = "Hamza", LastName = "Sevgili", Adress = "Gürses sokak", AdressCity = "Karabük", MobileNumber = "5435234234", Nationality = 1, HomeTown = 3, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.BNegative
                },
                new Patient {
                    FirstName = "Deniz", LastName = "Yıldırım", Adress = "Bayraktar sokak", AdressCity = "Zonguldak", MobileNumber = "5435234234", Nationality = 1, HomeTown = 1, IdentificationNumber = "1212313", BirthDate = DateTime.Parse("06-10-1999"), Gender = Models.Enums.Gender.Male, MaritalStatu = Models.Enums.MaritalStatu.Married, BloodType = Models.Enums.BloodType.ABPositive
                },
            };

            context.Patient.AddRange(patients);
            context.SaveChanges();

            var tests = new Test[]
            {
                new Test {
                    Name = "Blood Count"
                },
                new Test {
                    Name = "Hematocrit"
                },
                new Test {
                    Name = "Inulin Clearance"
                },
                new Test {
                    Name = "Serological Test"
                },
                new Test {
                    Name = "Hastric Fluid Analysis"
                },
                new Test {
                    Name = "Protein-Bound Iodine Test"
                },
                new Test {
                    Name = "Toxicology Test"
                },
                new Test {
                    Name = "Skin Test"
                },
                new Test {
                    Name = "Endoscopy"
                },
            };

            context.Test.AddRange(tests);
            context.SaveChanges();

            var medicines = new Medicine[]
            {
                new Medicine {
                    Name = "Aspirin", Brand = "Abdi Ibrahim ", Price = 55
                },
                new Medicine {
                    Name = "Majezik", Brand = "Eczacibasi", Price = 22
                },
                new Medicine {
                    Name = "Parol ", Brand = "Pzifer", Price = 26
                },
                new Medicine {
                    Name = "CBD", Brand = "Canabidol", Price = 29
                },
                new Medicine {
                    Name = "Doliprane", Brand = "Sanofi", Price = 67
                },
                new Medicine {
                    Name = "Aulin", Brand = "Angelini", Price = 99
                },
            };

            context.Medicine.AddRange(medicines);
            context.SaveChanges();

            var appointments = new Appointment[]
            {
                new Appointment {
                    Time = DateTime.Parse("21-02-2020 11:30"), DoctorId = 1, PatientId = 7, HospitalAndClinicId = 12
                },
                new Appointment {
                    Time = DateTime.Parse("21-03-2020 11:30"), DoctorId = 2, PatientId = 12, HospitalAndClinicId = 2
                },
                new Appointment {
                    Time = DateTime.Parse("12-03-2019 11:30"), DoctorId = 2, PatientId = 1, HospitalAndClinicId = 4
                },
                new Appointment {
                    Time = DateTime.Parse("02-06-2020 11:30"), DoctorId = 3, PatientId = 2, HospitalAndClinicId = 7
                },
                new Appointment {
                    Time = DateTime.Parse("16-08-2018 11:30"), DoctorId = 1, PatientId = 4, HospitalAndClinicId = 1
                },
                new Appointment {
                    Time = DateTime.Parse("22-09-2019 11:30"), DoctorId = 3, PatientId = 5, HospitalAndClinicId = 8
                },
                new Appointment {
                    Time = DateTime.Parse("28-11-2020 11:30"), DoctorId = 2, PatientId = 3, HospitalAndClinicId = 9
                },
            };

            context.Appointment.AddRange(appointments);
            context.SaveChanges();

            var examinations = new Examination[]
            {
                new Examination {
                    Id = 1, Diagnosis = "Headache"
                },
                new Examination {
                    Id = 3, Diagnosis = "Nausea"
                },
                new Examination {
                    Id = 5, Diagnosis = "Toothache"
                },
                new Examination {
                    Id = 6, Diagnosis = "Pregnancy"
                },
                new Examination {
                    Id = 4, Diagnosis = "Stabbing"
                },
                new Examination {
                    Id = 2, Diagnosis = "Broken arm"
                },
                new Examination {
                    Id = 7, Diagnosis = "Headache"
                },
            };

            context.Examination.AddRange(examinations);
            context.SaveChanges();

            var examinationAndTests = new ExaminationAndTest[]
            {
                new ExaminationAndTest {
                    ExaminationId = 2, TestId = 4
                },
                new ExaminationAndTest {
                    ExaminationId = 6, TestId = 3
                },
                new ExaminationAndTest {
                    ExaminationId = 1, TestId = 1
                },
                new ExaminationAndTest {
                    ExaminationId = 5, TestId = 5
                },
                new ExaminationAndTest {
                    ExaminationId = 3, TestId = 2
                },
                new ExaminationAndTest {
                    ExaminationId = 7, TestId = 6
                },
            };

            context.ExaminationAndTest.AddRange(examinationAndTests);
            context.SaveChanges();

            var prescriptions = new Prescription[]
            {
                new Prescription {
                    Id = 1, PrescriptionNumber = "d12ds", DateTime = DateTime.Parse("22-07-2020 12:30")
                },
                new Prescription {
                    Id = 3, PrescriptionNumber = "f23fd", DateTime = DateTime.Parse("27-05-2020 11:30")
                },
                new Prescription {
                    Id = 5, PrescriptionNumber = "f2f23", DateTime = DateTime.Parse("12-04-2020 15:30")
                },
                new Prescription {
                    Id = 7, PrescriptionNumber = "2d112", DateTime = DateTime.Parse("09-12-2020 22:30")
                },
                new Prescription {
                    Id = 4, PrescriptionNumber = "d1f22", DateTime = DateTime.Parse("04-11-2020 12:45")
                },
            };

            context.Prescription.AddRange(prescriptions);
            context.SaveChanges();

            var prescriptionAndMedicines = new PrescriptionAndMedicine[]
            {
                new PrescriptionAndMedicine {
                    PrescriptionId = 1, MedicineId = 1
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 3, MedicineId = 3
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 1, MedicineId = 6
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 1, MedicineId = 1
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 3, MedicineId = 1
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 3, MedicineId = 6
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 7, MedicineId = 5
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 5, MedicineId = 1
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 4, MedicineId = 1
                },
                new PrescriptionAndMedicine {
                    PrescriptionId = 4, MedicineId = 4
                },
            };

            context.PrescriptionAndMedicine.AddRange(prescriptionAndMedicines);
            context.SaveChanges();
        }
Beispiel #36
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 (user.Professionals.Count > 0)
         {
             prof = user.Professionals[0];
             txtProfessionalId.Text = prof.PersonId.ToString();
             txtProfessionalName.Text = prof.FullName;
         }
     }
     // 
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
         txtCustomerId.Text = cus.PersonId.ToString();
         txtComercialName.Text = cus.FullName;
         // if a patient has been passed we can not touch it
         txtCustomerId.Enabled = false;
         txtComercialName.Enabled = false;
         btnCustomerId.Visible = false;
         LoadPolicyCombo(null);
     }
     else
     {
         LoadPolicyCombo(null);
         LoadClinicCombo(null);
     }
     if (Session["Clinic"] != null)
         cl = (Clinic)Session["Clinic"];
     //
     if (Request.QueryString["ServiceNoteId"] != null)
     {
         serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
         sn = CntAriCli.GetServiceNote(serviceNoteId, ctx);
         // disable select fields
         cus = sn.Customer;
         txtCustomerId.Text = cus.PersonId.ToString(); txtCustomerId.Enabled = false;
         txtComercialName.Text = cus.FullName; txtComercialName.Enabled = false;
         cl = sn.Clinic;
         prof = sn.Professional;
         if (prof != null)
         {
             txtProfessionalId.Text = prof.PersonId.ToString(); txtProfessionalId.Enabled = false;
             txtProfessionalName.Text = prof.FullName; txtProfessionalName.Enabled = false;
         }
         rddpTicketDate.SelectedDate = sn.ServiceNoteDate;
     }
     // 
     if (Request.QueryString["TicketId"] != null)
     {
         ticketId = Int32.Parse(Request.QueryString["TicketId"]);
         tck = CntAriCli.GetTicket(ticketId, ctx);
         cus = tck.Policy.Customer;
         customerId = cus.PersonId;
         if (tck.ServiceNote != null)
         {
             sn = tck.ServiceNote;
             serviceNoteId = sn.ServiceNoteId;
         }
         LoadData(tck);
     }
     else
     {
         // If there isn't a ticket the default date must be today
         rddpTicketDate.SelectedDate = DateTime.Now;
         if (sn != null)
             rddpTicketDate.SelectedDate = sn.ServiceNoteDate;
         LoadPolicyCombo(null);
         LoadClinicCombo(null);
     }
 }
        public void CreateClinic(string name, int rooms)
        {
            IClinic clinic = new Clinic(name, rooms);

            this.clinics.Add(clinic);
        }
Beispiel #38
0
 protected void UnloadData(Clinic hc)
 {
     cl.Name = txtName.Text;
     cl.RemoteIp = txtRemoteIp.Text;
 }
    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);
        }
        if (Session["Clinic"] != null)
        {
            cl = (Clinic)Session["Clinic"];
        }
        // 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;
        }
        else if (type == "comprobante")
        {
            HtmlControl tt = (HtmlControl)this.FindControl("Actions");
            tt.Attributes["class"] = "ghost";
            // hide patient column
            //RadGrid1.Columns.FindByDataField("Policy.Customer.FullName").Visible = false;
            btnComp.Visible = true;

            lblTitle.Text = "Comprobantes";

            rdcbType.AutoPostBack = true;
            rdcbType.Items.Clear();
            rdcbType.Items.Add(new RadComboBoxItem("Con comprobante", "C"));
            rdcbType.Items.Add(new RadComboBoxItem("Sin comprobante", "SC"));

            RadGrid1.PageSize = 6;
        }
        else
        {
            //
            RadGrid1.PageSize = 6;
        }
        // translate filters
        CntWeb.TranslateRadGridFilters(RadGrid1);
        //
        LoadInsuranceCombo();
        LoadPayementFormCombo();
        LoadClinicCombo();
    }
Beispiel #40
0
 protected void Page_Init(object sender, EventArgs e)
 {
     ctx = new AriClinicContext("AriClinicContext");
     // security control, it must be a user logged
     // 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 == "usergroup"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     //
     if (Request.QueryString["HcId"] != null)
     {
         hcId = Int32.Parse(Request.QueryString["HcId"]);
         hc = CntAriCli.GetHealthCompany(ctx);
         txtCaller.Text = hc.Name;
     }
     //
     if (Request.QueryString["ClinicId"] != null)
     {
         clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
         cl = (from c in ctx.Clinics
               where c.ClinicId == clinicId
               select c).FirstOrDefault<Clinic>();
         txtCaller.Text = cl.Name;
     }
     //
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat = CntAriCli.GetPatient(patientId, ctx);
         txtCaller.Text = pat.FullName;
     }
     //
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
         txtCaller.Text = cus.FullName;
     }
     //
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof = CntAriCli.GetProfessional(professionalId, ctx);
         txtCaller.Text = prof.FullName;
     } 
     // 
     if (Request.QueryString["AddressId"] != null)
     {
         addressId = Int32.Parse(Request.QueryString["AddressId"]);
         Address adr = (from a in ctx.Addresses
                        where a.AddressId == addressId
                        select a).FirstOrDefault<Address>();
         LoadData(adr);
     }
     else
     {
         LoadTypeCombo(null);
     }
 }
Beispiel #41
0
        public void GetOpenQueries()
        {
            //Arrange
            var dataStorage = new Mock <IDataStorage>();
            var clinic      = new Clinic {
                Caption = "Clinic1"
            };
            var doctor1 = new User {
                FirstName = "DoctorFirst1", LastName = "DoctorLast1", Clinic = clinic
            };
            var doctor2 = new User {
                FirstName = "DoctorFirst2", LastName = "DoctorLast2", Clinic = clinic
            };
            var patient1 = new Patient {
                PatientNumber = 11, Doctor = doctor1
            };
            var patient2 = new Patient {
                PatientNumber = 12, Doctor = doctor2
            };
            var visit1 = new Visit {
                Caption = "Visit1", Patient = patient1
            };
            var visit2 = new Visit {
                Caption = "Visit2", Patient = patient2
            };
            var form1 = new Form {
                FormType = FormType.Happiness, Visit = visit1
            };
            var form2 = new Form {
                FormType = FormType.Demographics, Visit = visit2
            };
            var question1 = new Question {
                Form = form1
            };
            var question2 = new Question {
                Form = form2
            };
            var query1 = new Query {
                Id = 1, QueryText = "Text1", Question = question1
            };
            var query2 = new Query {
                Id = 2, QueryText = "Text2", AnswerText = "Answer1", Question = question2
            };


            var repository = new QueryRepository(dataStorage.Object);

            dataStorage.Setup(ds => ds.GetData <Query>()).Returns(new List <Query> {
                query1, query2
            });

            //Act
            var result = repository.GetOpenQueries();

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.EqualTo(1));
            var query = result.ToList()[0];

            Assert.That(query.FormType, Is.EqualTo(FormType.Happiness));
            Assert.That(query.ClinicName, Is.EqualTo("Clinic1"));
            Assert.That(query.DoctorName, Is.EqualTo("DoctorLast1"));
            Assert.That(query.QuestionText, Is.EqualTo("Text1"));
            Assert.That(query.PatientNumber, Is.EqualTo(11));
            Assert.That(query.VisitName, Is.EqualTo("Visit1"));
        }
Beispiel #42
0
        public int CreateOrUpdate(Clinic clinic)
        {
            if (clinic.Id == 0)
            {
                if (clinic.TreatmentCategories == null)
                {
                    clinic.TreatmentCategories = new List <TreatmentCategory>();
                }
                var clinicTreatmentCategoriesIds = clinic.TreatmentCategories.Select(x => x.Id);
                clinic.TreatmentCategories = _context.TreatmentCategories.Where(x => clinicTreatmentCategoriesIds.Contains(x.Id)).ToList();
                _context.Clinics.Add(clinic);
            }
            else
            {
                var oldClinic = _context.Clinics.Include("Hours").Include("TreatmentCategories").FirstOrDefault(c => c.Id == clinic.Id);

                oldClinic.BusinessName        = clinic.BusinessName;
                oldClinic.ShortName           = clinic.ShortName;
                oldClinic.IsActive            = clinic.IsActive;
                oldClinic.Address             = clinic.Address;
                oldClinic.State               = clinic.State;
                oldClinic.City                = clinic.City;
                oldClinic.Phone               = clinic.Phone;
                oldClinic.WorkHours           = clinic.WorkHours;
                oldClinic.Email               = clinic.Email;
                oldClinic.ContactPerson       = clinic.ContactPerson;
                oldClinic.Location            = clinic.Location;
                oldClinic.Comments            = clinic.Comments;
                oldClinic.BankAccountName     = clinic.BankAccountName;
                oldClinic.BankBsb             = clinic.BankBsb;
                oldClinic.BankAccountNumber   = clinic.BankAccountNumber;
                oldClinic.PaymentRatio        = clinic.PaymentRatio;
                oldClinic.ContractFileContent = clinic.ContractFileContent;
                oldClinic.ContractFileName    = clinic.ContractFileName;

                oldClinic.HowToFind = clinic.HowToFind;
                oldClinic.EmailAddressForOnlineBookings = clinic.EmailAddressForOnlineBookings;
                oldClinic.OwnersEmailAddress            = clinic.OwnersEmailAddress;
                oldClinic.BusinessWebsiteAddress        = clinic.BusinessWebsiteAddress;
                oldClinic.ABN                                     = clinic.ABN;
                oldClinic.OwnersName                              = clinic.OwnersName;
                oldClinic.OwnersPhoneNumber                       = clinic.OwnersPhoneNumber;
                oldClinic.WebsiteLocationAddress                  = clinic.WebsiteLocationAddress;
                oldClinic.IsContractSigned                        = clinic.IsContractSigned;
                oldClinic.IsTrained                               = clinic.IsTrained;
                oldClinic.IsTakenClientThroughWholesale           = clinic.IsTakenClientThroughWholesale;
                oldClinic.IsClientWholesaleLoginSetuped           = clinic.IsClientWholesaleLoginSetuped;
                oldClinic.IsLocationsDetailsSpreadsheetsCompleted = clinic.IsLocationsDetailsSpreadsheetsCompleted;
                oldClinic.DateOfListing                           = clinic.DateOfListing;
                oldClinic.BusinessAddress                         = clinic.BusinessAddress;
                oldClinic.StoreManagerPhoneNumber                 = clinic.StoreManagerPhoneNumber;
                oldClinic.DirectPhoneToTheLocation                = clinic.DirectPhoneToTheLocation;
                oldClinic.Lat                                     = clinic.Lat;
                oldClinic.Lng                                     = clinic.Lng;

                CreateOrUpdateTreatmentCategories(oldClinic, clinic);

                clinic.Hours.ForEach(oh => CreateOrUpdateHours(oldClinic.Hours, oh));
            }
            _context.SaveChanges();

            return(clinic.Id);
        }
Beispiel #43
0
        public void ReserveSearch()
        {
            ReserveClear();
            buttonList = new List <Button>();

            Clinic clinic = (Clinic)cmbClinic.SelectedValue;
            Doctor doctor = (Doctor)cmbDoctor.SelectedValue;

            DayOfWeek dayOfWeek = dtpReserveDateTime.Value.DayOfWeek;

            if (dayOfWeek == System.DayOfWeek.Saturday || dayOfWeek == System.DayOfWeek.Sunday)
            {
                MessageBox.Show("Randevu günün haftasonu için seçemezsiniz!", "Randevu Günü Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dtpReserveDateTime.Value = DateTime.Now;
                return;
            }

            groupBox.Controls.Clear();
            int    period    = _clinicBLL.GetClinicPeriod(clinic.Id);
            String startTime = "09:00";
            bool   flag      = true;

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Button button = new Button();
                    button.Width     = 70;
                    button.Height    = 30;
                    button.Top       = (i + 1) * 40;
                    button.Left      = (j + 1) * 80;
                    button.BackColor = Color.GreenYellow;

                    button.Text = Convert.ToDateTime(startTime).ToShortTimeString();
                    startTime   = Convert.ToDateTime(startTime).AddMinutes(period).ToString();
                    groupBox.Controls.Add(button);

                    button.Click += Button_Click;
                    buttonList.Add(button);
                    if (button.Text == "12:00")
                    {
                        startTime = "13:00";
                    }
                    if (button.Text == "17:00")
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag == false)
                {
                    break;
                }
            }

            List <String> listReserve = new List <String>();

            listReserve.AddRange(_reserveBLL.GetAll(dtpReserveDateTime.Value.Date, doctor.ID));

            for (int i = 0; i < buttonList.Count; i++)
            {
                for (int j = 0; j < listReserve.Count; j++)
                {
                    if (buttonList[i].Text == Convert.ToDateTime(listReserve[j]).ToShortTimeString())
                    {
                        buttonList[i].Enabled   = false;
                        buttonList[i].BackColor = Color.PaleVioletRed;
                    }
                }
            }

            for (int i = 0; i < buttonList.Count; i++)
            {
                if (buttonList[i].Enabled)
                {
                    txtDoctorFirstName.Text    = doctor.FullName;
                    txtDoctorClinic.Text       = clinic.Name;
                    txtReserveTime.Text        = buttonList[i].Text;
                    dtpDoctorReserveTime.Value = dtpReserveDateTime.Value;
                    break;
                }
            }
        }
Beispiel #44
0
 public int CompareTo(Clinic other)
 {
     return(this.Name.CompareTo(other.Name));
 }
Beispiel #45
0
 ///<summary>Converts a DataTable to a list of objects.</summary>
 internal static List<Clinic> TableToList(DataTable table)
 {
     List<Clinic> retVal=new List<Clinic>();
     Clinic clinic;
     for(int i=0;i<table.Rows.Count;i++) {
         clinic=new Clinic();
         clinic.ClinicNum          = PIn.Long  (table.Rows[i]["ClinicNum"].ToString());
         clinic.Description        = PIn.String(table.Rows[i]["Description"].ToString());
         clinic.Address            = PIn.String(table.Rows[i]["Address"].ToString());
         clinic.Address2           = PIn.String(table.Rows[i]["Address2"].ToString());
         clinic.City               = PIn.String(table.Rows[i]["City"].ToString());
         clinic.State              = PIn.String(table.Rows[i]["State"].ToString());
         clinic.Zip                = PIn.String(table.Rows[i]["Zip"].ToString());
         clinic.Phone              = PIn.String(table.Rows[i]["Phone"].ToString());
         clinic.BankNumber         = PIn.String(table.Rows[i]["BankNumber"].ToString());
         clinic.DefaultPlaceService= (PlaceOfService)PIn.Int(table.Rows[i]["DefaultPlaceService"].ToString());
         clinic.InsBillingProv     = PIn.Long  (table.Rows[i]["InsBillingProv"].ToString());
         retVal.Add(clinic);
     }
     return retVal;
 }
Beispiel #46
0
 ///<summary>Updates one Clinic in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(Clinic clinic,Clinic oldClinic)
 {
     string command="";
     if(clinic.Description != oldClinic.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(clinic.Description)+"'";
     }
     if(clinic.Address != oldClinic.Address) {
         if(command!=""){ command+=",";}
         command+="Address = '"+POut.String(clinic.Address)+"'";
     }
     if(clinic.Address2 != oldClinic.Address2) {
         if(command!=""){ command+=",";}
         command+="Address2 = '"+POut.String(clinic.Address2)+"'";
     }
     if(clinic.City != oldClinic.City) {
         if(command!=""){ command+=",";}
         command+="City = '"+POut.String(clinic.City)+"'";
     }
     if(clinic.State != oldClinic.State) {
         if(command!=""){ command+=",";}
         command+="State = '"+POut.String(clinic.State)+"'";
     }
     if(clinic.Zip != oldClinic.Zip) {
         if(command!=""){ command+=",";}
         command+="Zip = '"+POut.String(clinic.Zip)+"'";
     }
     if(clinic.Phone != oldClinic.Phone) {
         if(command!=""){ command+=",";}
         command+="Phone = '"+POut.String(clinic.Phone)+"'";
     }
     if(clinic.BankNumber != oldClinic.BankNumber) {
         if(command!=""){ command+=",";}
         command+="BankNumber = '"+POut.String(clinic.BankNumber)+"'";
     }
     if(clinic.DefaultPlaceService != oldClinic.DefaultPlaceService) {
         if(command!=""){ command+=",";}
         command+="DefaultPlaceService = "+POut.Int   ((int)clinic.DefaultPlaceService)+"";
     }
     if(clinic.InsBillingProv != oldClinic.InsBillingProv) {
         if(command!=""){ command+=",";}
         command+="InsBillingProv = "+POut.Long(clinic.InsBillingProv)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE clinic SET "+command
         +" WHERE ClinicNum = "+POut.Long(clinic.ClinicNum);
     Db.NonQ(command);
 }
    static void Main()
    {
        List <Clinic> clinics = new List <Clinic>();
        List <Pet>    pets    = new List <Pet>();

        int n = int.Parse(Console.ReadLine());

        for (int i = 0; i < n; i++)
        {
            string[] commandTokens = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            Pet    pet    = null;
            Clinic clinic = null;

            switch (commandTokens[0])
            {
            case "Create":
                if (commandTokens[1] == "Pet")
                {
                    string petName = commandTokens[2];
                    int    petAge  = int.Parse(commandTokens[3]);
                    string kind    = commandTokens[4];

                    pet = new Pet(petName, petAge, kind);
                    pets.Add(pet);
                }
                else if (commandTokens[1] == "Clinic")
                {
                    string clinicName = commandTokens[2];
                    int    roomsCount = int.Parse(commandTokens[3]);

                    try
                    {
                        clinic = new Clinic(clinicName, roomsCount);
                        clinics.Add(clinic);
                    }
                    catch (InvalidOperationException ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                break;

            case "Add":
                pet    = pets.FirstOrDefault(p => p.Name == commandTokens[1]);
                clinic = clinics.FirstOrDefault(c => c.Name == commandTokens[2]);

                Console.WriteLine(clinic.Add(pet));
                break;

            case "Release":
                clinic = clinics.FirstOrDefault(c => c.Name == commandTokens[1]);

                Console.WriteLine(clinic.Release());
                break;

            case "HasEmptyRooms":
                clinic = clinics.FirstOrDefault(c => c.Name == commandTokens[1]);

                Console.WriteLine(clinic.HasEmptyRooms());
                break;

            case "Print":
                if (commandTokens.Length == 2)
                {
                    clinic = clinics.FirstOrDefault(c => c.Name == commandTokens[1]);

                    clinic.Print();
                }
                else if (commandTokens.Length == 3)
                {
                    clinic = clinics.FirstOrDefault(c => c.Name == commandTokens[1]);
                    int roomNum = int.Parse(commandTokens[2]);

                    clinic.Print(roomNum);
                }
                break;
            }
        }
    }
Beispiel #48
0
 protected void LoadData(Clinic cl)
 {
     txtClinicId.Text = cl.ClinicId.ToString();
     txtName.Text = cl.Name;
     txtRemoteIp.Text = cl.RemoteIp;
 }
Beispiel #49
0
 ///<summary>Updates one Clinic in the database.</summary>
 internal static void Update(Clinic clinic)
 {
     string command="UPDATE clinic SET "
         +"Description        = '"+POut.String(clinic.Description)+"', "
         +"Address            = '"+POut.String(clinic.Address)+"', "
         +"Address2           = '"+POut.String(clinic.Address2)+"', "
         +"City               = '"+POut.String(clinic.City)+"', "
         +"State              = '"+POut.String(clinic.State)+"', "
         +"Zip                = '"+POut.String(clinic.Zip)+"', "
         +"Phone              = '"+POut.String(clinic.Phone)+"', "
         +"BankNumber         = '"+POut.String(clinic.BankNumber)+"', "
         +"DefaultPlaceService=  "+POut.Int   ((int)clinic.DefaultPlaceService)+", "
         +"InsBillingProv     =  "+POut.Long  (clinic.InsBillingProv)+" "
         +"WHERE ClinicNum = "+POut.Long(clinic.ClinicNum);
     Db.NonQ(command);
 }
Beispiel #50
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);
     }
     //
     if (Request.QueryString["HcId"] != null)
     {
         hcId           = Int32.Parse(Request.QueryString["HcId"]);
         hc             = CntAriCli.GetHealthCompany(ctx);
         txtCaller.Text = hc.Name;
     }
     //
     if (Request.QueryString["ClinicId"] != null)
     {
         clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
         cl       = (from c in ctx.Clinics
                     where c.ClinicId == clinicId
                     select c).FirstOrDefault <Clinic>();
         txtCaller.Text = cl.Name;
     }
     //
     if (Request.QueryString["PatientId"] != null)
     {
         patientId      = Int32.Parse(Request.QueryString["PatientId"]);
         pat            = CntAriCli.GetPatient(patientId, ctx);
         txtCaller.Text = pat.FullName;
     }
     //
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId     = Int32.Parse(Request.QueryString["CustomerId"]);
         cus            = CntAriCli.GetCustomer(customerId, ctx);
         txtCaller.Text = cus.FullName;
     }
     //
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof           = CntAriCli.GetProfessional(professionalId, ctx);
         txtCaller.Text = prof.FullName;
     }
     //
     if (Request.QueryString["EmailId"] != null)
     {
         emailId = Int32.Parse(Request.QueryString["EmailId"]);
         Email eml = (from t in ctx.Emails
                      where t.EmailId == emailId
                      select t).FirstOrDefault <Email>();
         LoadData(eml);
     }
     else
     {
         LoadTypeCombo(null);
     }
 }
 private User GetClinicSupervisor(Clinic clinic)
 {
     return(clinic.Doctors.FirstOrDefault(u => u.Role == ClinicalStudyRoles.Supervisor));
 }
        private void RunNetProductionDetail()
        {
            ReportComplex report = new ReportComplex(true, true);

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < listProv.Items.Count; i++)
                {
                    listProv.SetSelected(i, true);
                }
            }
            if (checkAllClin.Checked)
            {
                for (int i = 0; i < listClin.Items.Count; i++)
                {
                    listClin.SetSelected(i, true);
                }
            }
            dateFrom = dtPickerFrom.Value;
            dateTo   = dtPickerTo.Value;
            if (radioTransactionalToday.Checked)
            {
                dateFrom = DateTime.Today;
                dateTo   = DateTime.Today;
            }
            List <Provider> listProvs = new List <Provider>();

            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                listProvs.Add(_listProviders[listProv.SelectedIndices[i]]);
            }
            List <Clinic> listClinics = new List <Clinic>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinics.Add(_listClinics[listClin.SelectedIndices[i]]);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            Clinic unassigned = new Clinic();
                            unassigned.ClinicNum = 0;
                            unassigned.Abbr      = Lan.g(this, "Unassigned");
                            listClinics.Add(unassigned);
                        }
                        else
                        {
                            listClinics.Add(_listClinics[listClin.SelectedIndices[i] - 1]);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            string reportName = "Provider Payroll Transactional Detailed";

            if (radioTransactionalToday.Checked)
            {
                reportName += " Today";
            }
            report.ReportName = reportName;
            report.AddTitle("Title", Lan.g(this, "Provider Payroll Transactional Report"));
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle));
            if (radioTransactionalToday.Checked)
            {
                report.AddSubTitle("Date", DateTime.Today.ToShortDateString());
            }
            else
            {
                report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString());
            }
            if (checkAllProv.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                string str = "";
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        str += ", ";
                    }
                    str += _listProviders[listProv.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Providers", str);
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            //setup query
            QueryObject query;
            DataTable   dt = RpProdInc.GetNetProductionDetailDataSet(dateFrom, dateTo, listProvs, listClinics
                                                                     , checkAllProv.Checked, checkAllClin.Checked, PrefC.GetBool(PrefName.NetProdDetailUseSnapshotToday));

            query = report.AddQuery(dt, "", "", SplitByKind.None, 1, true);
            // add columns to report
            Font font = new Font("Tahoma", 8, FontStyle.Regular);

            query.AddColumn("Type", 80, FieldValueType.String, font);
            query.AddColumn("Date", 70, FieldValueType.Date, font);
            query.AddColumn("Clinic", 70, FieldValueType.String, font);
            query.AddColumn("PatNum", 70, FieldValueType.String, font);
            query.AddColumn("Patient", 70, FieldValueType.String, font);
            query.AddColumn("ProcCode", 90, FieldValueType.String, font);
            query.AddColumn("Provider", 80, FieldValueType.String, font);
            query.AddColumn("UCR", 80, FieldValueType.Number, font);
            query.AddColumn("OrigEstWO", 100, FieldValueType.Number, font);
            query.AddColumn("EstVsActualWO", 80, FieldValueType.Number, font);
            query.AddColumn("Adjustment", 80, FieldValueType.Number, font);
            query.AddColumn("NPR", 80, FieldValueType.Number, font);
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())             //Does not actually submit queries because we use datatables in the central management tool.
            {
                return;
            }
            // display the report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;//Allow running multiple reports.
        }
Beispiel #53
0
    public int Ins_FacilityInfo(FacilityInfo facInfo,Clinic clinic,string userID)
    {
        int flag = 0;
        try
        {
            SqlConnection con = new SqlConnection(conStr);
            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = con;
            sqlCmd.CommandText = "sp_set_Facility_Info";
            sqlCmd.CommandType = CommandType.StoredProcedure;
            SqlParameter FacilityID = sqlCmd.Parameters.Add("@Facility_ID", SqlDbType.VarChar, 15);
            if (facInfo.FacilityID != null)
            FacilityID.Value = facInfo.FacilityID;
            else
            FacilityID.Value = Convert.DBNull;

            SqlParameter FacilityName = sqlCmd.Parameters.Add("@Facility_Name", SqlDbType.VarChar, 50);
            if (facInfo.FacilityName != null)
                FacilityName.Value = facInfo.FacilityName;
            else
                FacilityName.Value = Convert.DBNull;

            SqlParameter FacilityAddress = sqlCmd.Parameters.Add("@Facility_Address", SqlDbType.VarChar, 50);
            if(facInfo.FacilityAddress != null)
            FacilityAddress.Value = facInfo.FacilityAddress;
            else
                FacilityAddress.Value = Convert.DBNull;

            SqlParameter FacilityCity = sqlCmd.Parameters.Add("@Facility_City", SqlDbType.VarChar, 50);
            if (facInfo.FacilityCity != null)
            FacilityCity.Value = facInfo.FacilityCity;
            else
                FacilityCity.Value = Convert.DBNull;

            SqlParameter FacilityState = sqlCmd.Parameters.Add("@Facility_State", SqlDbType.Char, 2);
            if (facInfo.FacilityState != null)
            FacilityState.Value = facInfo.FacilityState.ToCharArray();
            else
                 FacilityState.Value = Convert.DBNull;

            SqlParameter FacilityZip = sqlCmd.Parameters.Add("@Facility_Zip", SqlDbType.Char, 10);
            if (facInfo.FacilityZip != null) 
                FacilityZip.Value = facInfo.FacilityZip.ToCharArray();
            else
                FacilityZip.Value = Convert.DBNull;

            SqlParameter FacilityTPhone = sqlCmd.Parameters.Add("@Facility_TPhone", SqlDbType.VarChar, 15);
            if (facInfo.FacilityTPhone != null) 
                FacilityTPhone.Value = facInfo.FacilityTPhone;
            else 
                FacilityTPhone.Value = Convert.DBNull;

            SqlParameter FacilityFax = sqlCmd.Parameters.Add("@Facility_Fax", SqlDbType.VarChar, 15);
            if (FacilityFax != null) 
                FacilityFax.Value = facInfo.FacilityFax;
            else
                FacilityFax.Value = Convert.DBNull;
            SqlParameter FacilityEMail = sqlCmd.Parameters.Add("@Facility_EMail", SqlDbType.VarChar, 50);
            if (facInfo.FacilityEMail != null) 
                FacilityEMail.Value = facInfo.FacilityEMail;
            else
                FacilityEMail.Value = Convert.DBNull;

            SqlParameter FacilityTaxID = sqlCmd.Parameters.Add("@Facility_TaxID", SqlDbType.VarChar, 20);
            if (facInfo.FacilityTaxID != null) 
                FacilityTaxID.Value = facInfo.FacilityTaxID;
            else
                FacilityTaxID.Value = Convert.DBNull;

            SqlParameter FacilitySpeciality = sqlCmd.Parameters.Add("@Facility_Speciality", SqlDbType.VarChar, 20);
            if (facInfo.FacilitySpeciality != null) 
                FacilitySpeciality.Value = facInfo.FacilitySpeciality;
            else
                FacilitySpeciality.Value =Convert.DBNull;

            SqlParameter FacilityProvID = sqlCmd.Parameters.Add("@Facility_ProvID", SqlDbType.VarChar, 20);
            if (facInfo.FacilityProvID != null) 
                FacilityProvID.Value = facInfo.FacilityProvID;
            else
                FacilityProvID.Value = Convert.DBNull;

            SqlParameter ClinicID = sqlCmd.Parameters.Add("@ClinicID",SqlDbType.Int);
            if (clinic.ClinicID != null)
                ClinicID.Value = clinic.ClinicID;
            else
                ClinicID.Value = Convert.DBNull;

            SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
            pUserID.Value = userID;

            SqlParameter parmIsStamps = sqlCmd.Parameters.Add("@IsStamps", SqlDbType.Char, 1);
            parmIsStamps.Value = facInfo.IsStamps;

            con.Open();
            sqlCmd.ExecuteNonQuery();
            flag = 1;
            con.Close();

        }

        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
             
        }

        return flag;
    }
        public Clinic GetClinicalNewMobile(DataConnection pclsCache, string UserId, DateTime AdmissionDate, DateTime ClinicDate, int Num)
        {
            //最终输出
            Clinic Clinic = new Clinic();

            Clinic.UserId  = UserId;
            Clinic.History = new List <ClinicBasicInfoandTime>();
            try
            {
                List <DT_Clinical_All> DT_Clinical_All = new List <DT_Clinical_All>();   //住院,门诊、检查化验。。。混合表
                //DT_Clinical_All.Columns.Add(new DataColumn("精确时间", typeof(DateTime)));
                //DT_Clinical_All.Columns.Add(new DataColumn("时间", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("类型", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("VisitId", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("事件", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("关键属性", typeof(string)));  //检查化验的详细查看  例:examnation|

                //颜色由文字决定


                #region 读取两张就诊表,并通过VisitId取出其他数据(检查、化验等)  全部拿出 按时间  VID 类型  排序后,合并

                List <ClinicalTrans> DT_Clinical_ClinicInfo = new List <ClinicalTrans>();
                DT_Clinical_ClinicInfo = clinicInfoMethod.PsClinicalInfoGetClinicalInfoNum(pclsCache, UserId, AdmissionDate, ClinicDate, Num);
                if (DT_Clinical_ClinicInfo != null)
                {
                    #region
                    if (DT_Clinical_ClinicInfo.Count > 1)    //肯定大于0,最后一条是标记,必须传回;大于1表明时间轴还可以加载
                    {
                        #region  拿出临床信息

                        for (int i = 0; i < DT_Clinical_ClinicInfo.Count - 1; i++)                                                 //最后一条是标记,需要单独拿出
                        {
                            string          DateShow = Convert.ToDateTime(DT_Clinical_ClinicInfo[i].精确时间).ToString("yyyy年MM月dd日"); //取日期
                            DT_Clinical_All item     = new DT_Clinical_All();
                            item.精确时间    = DT_Clinical_ClinicInfo[i].精确时间;
                            item.时间      = DateShow;
                            item.类型      = DT_Clinical_ClinicInfo[i].类型;
                            item.VisitId = DT_Clinical_ClinicInfo[i].VisitId;
                            item.事件      = DT_Clinical_ClinicInfo[i].事件;
                            item.关键属性    = "";
                            DT_Clinical_All.Add(item);
                            if (DT_Clinical_ClinicInfo[i].类型.ToString() == "入院")
                            {
                                //转科处理  转科内容:什么时候从哪里转出,什么时候转到哪里
                                List <ClinicalTrans> DT_Clinical_Trans = new List <ClinicalTrans>();
                                DT_Clinical_Trans = clinicInfoMethod.PsClinicalInfoGetTransClinicalInfo(pclsCache, UserId, DT_Clinical_ClinicInfo[i].VisitId.ToString());
                                if (DT_Clinical_Trans.Count > 0)  //有转科
                                {
                                    for (int n = 0; n < DT_Clinical_Trans.Count; n++)
                                    {
                                        string DateShow1 = Convert.ToDateTime(DT_Clinical_Trans[n].精确时间).ToString("yyyy年MM月dd日");  //取日期
                                        item.精确时间    = DT_Clinical_Trans[n].精确时间;
                                        item.时间      = DateShow1;
                                        item.类型      = "转科";
                                        item.VisitId = DT_Clinical_Trans[n].VisitId;
                                        item.事件      = DT_Clinical_Trans[n].事件;
                                        item.关键属性    = "";
                                        DT_Clinical_All.Add(item);
                                    }
                                }
                            }


                            if ((DT_Clinical_ClinicInfo[i].类型.ToString() == "入院") || (DT_Clinical_ClinicInfo[i].类型.ToString() == "门诊") || (DT_Clinical_ClinicInfo[i].类型.ToString() == "急诊"))
                            {
                                //诊断检查等
                                List <ClinicalTrans> DT_Clinical_Others = new List <ClinicalTrans>();
                                DT_Clinical_Others = clinicInfoMethod.PsClinicalInfoGetOtherTable(pclsCache, UserId, DT_Clinical_ClinicInfo[i].VisitId.ToString());


                                if (DT_Clinical_Others.Count > 0)
                                {
                                    for (int n = 0; n < DT_Clinical_Others.Count; n++)
                                    {
                                        string DateShow2 = Convert.ToDateTime(DT_Clinical_Others[n].精确时间).ToString("yyyy年MM月dd日");  //取日期
                                        item.精确时间    = DT_Clinical_Others[n].精确时间;
                                        item.时间      = DateShow2;
                                        item.类型      = DT_Clinical_Others[n].类型;
                                        item.VisitId = DT_Clinical_Others[n].VisitId;
                                        item.事件      = DT_Clinical_Others[n].事件;
                                        item.关键属性    = DT_Clinical_Others[n].关键属性;
                                        DT_Clinical_All.Add(item);
                                    }

                                    //DataRow[] rows = DT_Clinical_Others.Select();
                                    //foreach (DataRow row in rows)  // 将查询的结果添加到dt中;
                                    //{
                                    //    DT_Clinical_All.Rows.Add(row.ItemArray);
                                    //}
                                    //for(int j=0; j<DT_Clinical_Others.Rows.Count;j++)
                                    //{
                                    //     DT_Clinical_All.Rows.Add(DT_Clinical_Others.Rows[j]);
                                    //}
                                }
                            }
                        } //for循环的结尾
                        #endregion


                        //排序   按“精准时间”, “VID”    排序后, “时间”、“VID”相同的合并  【精准时间到s,时间到天】
                        DT_Clinical_All.Sort((x, y) => - (x.时间.CompareTo(y.时间) * 3 + x.VisitId.CompareTo(y.VisitId) * 2 - x.精确时间.CompareTo(y.精确时间)));
                        //dv.Sort = "时间 desc,  VisitId desc, 精确时间 Asc"; //目前采用方案二,
                        //时间轴需要倒序,升序Asc    时间轴最外层 日期倒序 某一天内按照时分升序  注意:遇到同一天 又住院又门诊的,即不同VID  方案:一、不拆开,按时间排即可,问题是会混乱; 二,拆开,时间、VID、精确时间   这样的话,按照目前是在一个方框里 颜色字体大小区分开
                        List <DT_Clinical_All> dtNew = DT_Clinical_All;

                        #region 如果两者“时间”、“VID”相同则合并   时间轴方框标签-完成后遍历每一个方框内的事件确定标签

                        List <ClinicBasicInfoandTime> history     = new List <ClinicBasicInfoandTime>(); //总  时间、事件的集合
                        ClinicBasicInfoandTime        temphistory = new ClinicBasicInfoandTime();
                        if (dtNew != null)
                        {
                            #region
                            if (dtNew.Count > 0)
                            {
                                string TimeMark    = dtNew[0].时间.ToString();
                                string VisitIdMark = dtNew[0].VisitId.ToString();
                                temphistory.Time    = TimeMark;
                                temphistory.VisitId = VisitIdMark;

                                List <SomeDayEvent> ItemGroup    = new List <SomeDayEvent>();
                                SomeDayEvent        SomeDayEvent = new SomeDayEvent();
                                SomeDayEvent.Type    = dtNew[0].类型.ToString();                              //已有类型集合:入院、出院、转科、门诊、急诊、当前住院中;诊断、检查、化验、用药   【住院中未写入】
                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[0].精确时间).ToString("HH:mm"); //取时分 HH:mm(24) hh:mm(12)
                                SomeDayEvent.Event   = dtNew[0].事件.ToString();
                                SomeDayEvent.KeyCode = dtNew[0].关键属性.ToString();
                                ItemGroup.Add(SomeDayEvent);

                                if (dtNew.Count > 1)
                                {
                                    for (int i = 1; i < dtNew.Count; i++)
                                    {
                                        string TimeMark1    = dtNew[i].时间.ToString();
                                        string VisitIdMark1 = dtNew[i].VisitId.ToString();

                                        if (i == dtNew.Count - 1)
                                        {
                                            if ((TimeMark1 == TimeMark) && (VisitIdMark1 == VisitIdMark))
                                            {
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);
                                            }
                                            else
                                            {
                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);

                                                temphistory         = new ClinicBasicInfoandTime();
                                                temphistory.Time    = TimeMark1;
                                                temphistory.VisitId = VisitIdMark1;

                                                ItemGroup            = new List <SomeDayEvent>();
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);
                                            }
                                        }
                                        else
                                        {
                                            if ((TimeMark1 == TimeMark) && (VisitIdMark1 == VisitIdMark))
                                            {
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);
                                            }
                                            else
                                            {
                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);

                                                temphistory         = new ClinicBasicInfoandTime();
                                                temphistory.Time    = TimeMark1;
                                                temphistory.VisitId = VisitIdMark1;

                                                ItemGroup            = new List <SomeDayEvent>();
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                TimeMark    = TimeMark1;
                                                VisitIdMark = VisitIdMark1;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    temphistory.ItemGroup = ItemGroup;
                                    history.Add(temphistory);
                                }
                            }
                            #endregion
                        }

                        #endregion


                        #region 时间轴块标签、颜色
                        //类型 入院、出院、转科、门诊、急诊、当前住院中;诊断、检查、化验、用药   【住院中未写入】
                        //标签 入院、出院、转科、门诊、住院中、急诊
                        if (history != null)
                        {
                            #region
                            for (int n = 0; n < history.Count; n++)
                            {
                                for (int m = 0; m < history[n].ItemGroup.Count; m++)
                                {
                                    if ((history[n].ItemGroup[m].Type == "入院") || (history[n].ItemGroup[m].Type == "出院") || (history[n].ItemGroup[m].Type == "转科") || (history[n].ItemGroup[m].Type == "门诊") || (history[n].ItemGroup[m].Type == "急诊") || (history[n].ItemGroup[m].Type == "当前住院中"))
                                    {
                                        history[n].Tag += history[n].ItemGroup[m].Type + "、";
                                    }
                                }

                                if ((history[n].Tag == "") || (history[n].Tag == null))
                                {
                                    //防止门诊、急诊逸出
                                    if (history[n].VisitId.Substring(0, 1) == "I")  //住院
                                    {
                                        history[n].Tag   = "住院中";
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("住院中");
                                    }
                                    else if (history[n].VisitId.Substring(0, 1) == "O") //门诊
                                    {
                                        history[n].Tag   = "";                          //门诊
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("门诊");
                                    }
                                    else if (history[n].VisitId.Substring(0, 1) == "E") //急诊
                                    {
                                        history[n].Tag   = "";                          //急诊
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("急诊");
                                    }
                                    //history[n].Tag = "住院中";
                                    //history[n].Color = PsClinicalInfo.GetColor("住院中");
                                }
                                else
                                {
                                    int z = history[n].Tag.IndexOf("、");
                                    //history[n].Color = PsClinicalInfo.GetColor(history[n].Tag.Substring(0, z));   //若有多个标签,颜色取第一个
                                    history[n].Tag = history[n].Tag.Substring(0, history[n].Tag.Length - 1);                                                   //去掉最后的、
                                    //int end= history[n].Tag.LastIndexOf("、")+1;
                                    history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor(history[n].Tag.Substring(history[n].Tag.LastIndexOf("、") + 1)); //若有多个标签,颜色取最后一个
                                }
                            }
                            #endregion
                        }


                        #endregion

                        Clinic.History = history;   //时间轴
                    }  //if (DT_Clinical_ClinicInfo.Rows.Count > 1)的结尾


                    //取出指针标记
                    int mark = DT_Clinical_ClinicInfo.Count - 1;
                    Clinic.AdmissionDateMark = DT_Clinical_ClinicInfo[mark].精确时间.ToString();
                    Clinic.ClinicDateMark    = DT_Clinical_ClinicInfo[mark].类型.ToString();

                    //确定是否能继续加载
                    if ((DT_Clinical_ClinicInfo.Count - 1) < Num)
                    {
                        Clinic.mark_contitue = "0";
                    }
                    else
                    {
                        string mark_in  = clinicInfoMethod.PsClinicalInfoGetNextInDate(pclsCache, UserId, Clinic.AdmissionDateMark);
                        string mark_out = clinicInfoMethod.PsClinicalInfoGetNextOutDate(pclsCache, UserId, Clinic.ClinicDateMark);
                        if (((mark_in == "") && (mark_out == "")) || ((mark_in == null) && (mark_out == null)))
                        {
                            Clinic.mark_contitue = "0";
                        }
                        else
                        {
                            Clinic.mark_contitue = "1";
                        }
                    }
                    #endregion
                }
                #endregion

                return(Clinic);
                //string result_final = JSONHelper.ObjectToJson(Clinic);
                //Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
                //Context.Response.Write(result_final);

                //Context.Response.End();
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetReminder", "WebService调用异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                // return null;
                throw (ex);
            }
        }
 protected void DoPayments()
 {
     ArrayList selectedItems = (ArrayList)Session["selectedItems"];
     PaymentMethod pm = CntAriCli.GetPaymentMethod(Int32.Parse(rdcbPayementForm.SelectedValue), ctx);
     cl = CntAriCli.GetClinic(Int32.Parse(rdcbClinic.SelectedValue), ctx);
     DateTime pd = (DateTime)rddpPayDate.SelectedDate;
     //foreach(GridDataItem item in RadGrid1.SelectedItems)
     //{
     //    int id = Int32.Parse(item["TicketId"].Text);
     foreach (string item in selectedItems)
     {
         int id = int.Parse(item);
         Ticket tck = CntAriCli.GetTicket(id, ctx);
         // Delete previous payments
         ctx.Delete(tck.Payments);
         Payment p = new Payment();
         p.PaymentDate = pd;
         p.Clinic = cl;
         p.PaymentMethod = pm;
         p.Ticket = tck;
         p.Amount = tck.Amount;
         p.User = CntAriCli.GetUser(user.UserId, ctx);
         tck.Paid = p.Amount;
         ctx.Add(p);
         ctx.SaveChanges();
     }
     
     lblMessage.Text = Resources.GeneralResource.PaymentsDone;
     Session["selectedItems"] = new ArrayList();
     RadGrid1.Rebind();
 }
 protected void LoadClinicCombo(Clinic clinic)
 {
     rdcbClinic.Items.Clear();
     foreach (Clinic c in CntAriCli.GetClinics(ctx))
     {
         rdcbClinic.Items.Add(new RadComboBoxItem(c.Name, c.ClinicId.ToString()));
     }
     if (clinic != null)
     {
         rdcbClinic.SelectedValue = clinic.ClinicId.ToString();
     }
     else
     {
         rdcbClinic.Items.Add(new RadComboBoxItem(" ", ""));
         rdcbClinic.SelectedValue = "";
     }
 }