public async Task <IActionResult> Edit(int id, [Bind("Id,fName,lName,streetAddress,city,state,phoneNumber,email,profession,rate,averageRating,company,image")] Professional professional)
        {
            if (id != professional.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(professional);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfessionalExists(professional.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(professional));
        }
Пример #2
0
        public void GetFollower()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                Dictionary<Patient, Professional[]> expectedFollow = new Dictionary<Patient, Professional[]>();
                Professional[] proArray = new Professional[10];

                proArray.SetValue(context.SelectRequest.SelectProfessional("SimonF", "SimonF"), 0);
                proArray.SetValue(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), 1);
                proArray.SetValue(context.SelectRequest.SelectProfessional("OlivierS", "OlivierS"), 2);

                expectedFollow.Add(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"), proArray);
                Dictionary<Patient, Professional[]> allFollow = _followerService.getDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);


                foreach (var pair in allFollow)
                {
                    Assert.AreEqual(pair.Key.PatientId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
                    for (int i = 0; i < 3; i++)
                    {
                        Assert.AreEqual(pair.Value[i].ProfessionalId, proArray[i].ProfessionalId);
                    }
                }
            }
        }
        public ServiceResult<Professional> Update(Professional professional)
        {
            var emailExist = _repository.GetProfessionalByEmailWithoutId(professional.ProfessionalId, professional.Email);

            if (emailExist == null)
            {
                var user = new User
                {
                    Email = professional.Email,
                    FirstName = professional.FirstName,
                    SecondName = professional.SecondName,
                    Surname = professional.Surname,
                    SecondSurname = professional.SecondSurname,
                    UserId = professional.UserId,
                    State = professional.State

                };
                var userUpdate = _userRepository.Update(user);
                var updated = _repository.Update(professional);
                return new ServiceResult<Professional>
                {
                    Success = true,
                    Result = updated
                };
            }

            return new ServiceResult<Professional>
            {
                Success = false,
                Errors = new[] { MessageError.EmailExists }
            };
        }
Пример #4
0
        public ActionResult CreateRating([Bind(Include = "Rating,UserName,PostId")] UserToPostRating uTPR)
        {
            db.UserToPostRatings.Add(uTPR);
            db.SaveChanges();
            Post post = db.Posts.Where(d => d.PostID == uTPR.PostId).ToList().ElementAt(0);

            post.NumOfRating += 1;
            db.SaveChanges();
            int sum = 0;

            foreach (var item in db.UserToPostRatings.Where(d => d.PostId == uTPR.PostId).ToList())
            {
                sum += item.Rating;
            }
            post.Rating = sum / post.NumOfRating;
            db.SaveChanges();
            string       postCreator = db.ProfessionalPages.Where(d => d.ProfessionalPageID == post.ProfessionalPageID).ToList().ElementAt(0).UserName;
            Professional pro         = db.Professionals.Where(d => d.UserName == postCreator).ToList().ElementAt(0);
            var          listOfPP    = db.ProfessionalPages.Where(d => d.UserName == pro.UserName).ToList();
            double       score       = 0;
            int          sumOfPosts  = 0;

            foreach (var pp in listOfPP)
            {
                foreach (var p in pp.Posts.ToList())
                {
                    sumOfPosts++;
                    score += p.Rating;
                }
            }
            pro.Score = score / sumOfPosts;
            db.SaveChanges();
            return(Redirect("../Posts/Details/" + uTPR.PostId));
        }
Пример #5
0
        public List <Professional> GetSampleProfessionals()
        {
            var professional1 = new Professional()
            {
                Person = new Person()
                {
                    Name        = "Arnold Schwarzenegger",
                    Birthday    = new DateTime(1947, 7, 30),
                    Nationality = "Austria"
                },
                Ocupation = Ocupation.Actor
            };

            var professional2 = new Professional()
            {
                Person = new Person()
                {
                    Name        = "Linda Hamilton",
                    Birthday    = new DateTime(1956, 9, 26),
                    Nationality = "United States of America"
                },
                Ocupation = Ocupation.Actor
            };


            return(new List <Professional>()
            {
                professional1,
                professional2
            });
        }
        public bool CreateDefaultAgendaByProfessional(Professional professional)
        {
            try
            {
                var agenda = new Agenda
                {
                    Name              = "Principal",
                    Professional      = professional,
                    AppointmentTypeID = professional.ProfessionalAppointmentTypes.FirstOrDefault().AppointmentTypeId,
                    Value             = 100,
                    AgendaSchedule    = new AgendaSchedule
                    {
                        BeginTime    = 480,
                        EndTime      = 1080,
                        Date         = DateTime.Today,
                        IntervalTime = 30
                    }
                };

                Context.Agenda.Add(agenda);
                Context.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #7
0
    protected void UnloadData(Professional prof)
    {
        prof.FullName      = txtFullName.Text;
        prof.VATIN         = txtVATIN.Text;
        prof.ComercialName = txtComercialName.Text;
        prof.Type          = rdcbType.SelectedValue;
        if (rdcbUser.SelectedValue != "")
        {
            int id = Int32.Parse(rdcbUser.SelectedValue);
            prof.User = CntAriCli.GetUser(id, ctx);
        }
        else
        {
            prof.User = null;
        }

        prof.License = txtLicense.Text;

        if (rdcbTaxWithholding.SelectedValue != "")
        {
            int id = Int32.Parse(rdcbTaxWithholding.SelectedValue);
            prof.TaxWithholdingType = CntAriCli.GetTaxWithholdingType(id, ctx);
        }

        prof.InvoiceSerial = txtInvoiceSerial.Text;

        if (txtCommision.Text != "")
        {
            prof.Commission = Decimal.Parse(txtCommision.Text);
        }
    }
Пример #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 == "professional"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        //
        if (Request.QueryString["ProfessionalId"] != null)
        {
            professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
            prof           = CntAriCli.GetProfessional(professionalId, ctx);
            LoadData(prof);
        }
        else
        {
            LoadUserCombo(null);
            LoadTypeCombo(null);
            LoadTaxWithholdingTypeCombo(null);
        }
    }
Пример #9
0
        public void MapTo_Professional_To_ProfessionalPoco()
        {
            var entity = new Professional
            {
                Address        = new Address("Rua de teste", "123", "Complement", new ZipCode("12345678")),
                ProfessionalId = 1,
                Code           = Guid.NewGuid(),
                Email          = "*****@*****.**",
                Name           = "Professional",
                Specialties    = new List <Specialty>
                {
                    new Specialty {
                        Id = 1, Description = "Especialidade"
                    }
                }
            };

            var mappPoco = entity.MapTo <ProfessionalPoco>();

            Assert.NotNull(mappPoco);
            Assert.Equal(entity.ProfessionalId, mappPoco.ProfessionalId);
            Assert.Equal(entity.Code, mappPoco.Code);
            Assert.Equal(entity.Name, mappPoco.Name);
            Assert.Equal(entity.Email, mappPoco.Email);
            Assert.Equal(entity.Phone, mappPoco.Phone);
            Assert.NotNull(mappPoco.Address);
            Assert.Equal(entity.Address.Complement, mappPoco.AddressComplement);
            Assert.Equal(entity.Address.Number, mappPoco.AddressNumber);
            Assert.Equal(entity.Address.Street, TextHelper.ToTitleCase(mappPoco.Address));
            Assert.Equal(entity.Address.ZipCode.Number, mappPoco.ZipCode);
            Assert.Null(mappPoco.ProfessionalSpecialties);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Profession,Mobile,Skills,ExperienceInYears,IsBooked,HourlyRate")] Professional professional)
        {
            if (id != professional.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(professional);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfessionalExists(professional.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(professional));
        }
Пример #11
0
    protected void UnloadData(User u)
    {
        u.Name  = txtName.Text;
        u.Login = txtLogin.Text;
        if (txtPassword2.Text != "")
        {
            u = CntAriCli.EncryptPassword(u, txtPassword1.Text);
        }
        int id = Int32.Parse(ddlGroup.SelectedValue);

        u.UserGroup = (from ug in ctx.UserGroups
                       where ug.UserGroupId == id
                       select ug).FirstOrDefault <UserGroup>();
        if (ddlProfessional.SelectedValue != "")
        {
            Professional p = CntAriCli.GetProfessional(int.Parse(ddlProfessional.SelectedValue), ctx);
            if (p != null)
            {
                p.User = u;
            }
        }
        u.Profile       = int.Parse(ddlProfile.SelectedValue);
        u.BaseVisitType = (from bvt in ctx.BaseVisitTypes
                           where bvt.Code == ddlBaseVisitType.SelectedValue
                           select bvt).FirstOrDefault <BaseVisitType>();
    }
Пример #12
0
        public bool Add(Professional newProfessional)
        {
            using (var sql = new NpgsqlConnection(ConnectionProvider.GetConnectionString()))
            {
                try
                {
                    var setCredentialsResponse = sql.Execute(
                        @"INSERT INTO credential (email, password) VALUES (@email, @password)",
                        new
                    {
                        newProfessional.credentials.email,
                        newProfessional.credentials.password
                    });
                }
                catch (PostgresException)
                {
                    return(false);
                }

                var response = sql.Execute(@"
                    INSERT INTO professional (name, birthdate, cpf, sex, email, type, professionalid)
                    VALUES (@name, @birthdate, @cpf, @sex::SEX, @email, @type, @professionalId)",
                                           new
                {
                    newProfessional.name,
                    birthdate      = newProfessional.birthDate,
                    cpf            = newProfessional.CPF,
                    sex            = char.ToUpper(newProfessional.sex.ToString().ElementAt(0)).ToString(),
                    email          = newProfessional.credentials.email,
                    type           = newProfessional.type,
                    professionalId = newProfessional.professionalId
                });
                return(Convert.ToBoolean(response));
            }
        }
        public async Task <IActionResult> PutProfessional(int id, Professional professional)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != professional.Id)
            {
                return(BadRequest());
            }

            try
            {
                await _professionalRepo.UpdateAsync(professional);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_professionalRepo.Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #14
0
        public async Task <IHttpActionResult> PutProfessional(int id, Professional professional)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != professional.Id)
            {
                return(BadRequest());
            }

            db.Entry(professional).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfessionalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #15
0
        public async Task <IActionResult> PutProfessional(int id, Professional professional)
        {
            if (id != professional.Id)
            {
                return(BadRequest());
            }

            _context.Entry(professional).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfessionalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #16
0
        public bool UpdateProfessional(Professional professional)
        {
            using (var conn = new SqlConnection(PrescienceRxConnectionString))
            {
                conn.Open();

                using (var cmd = new SqlCommand(UpdateProfessionalSp, conn))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.Parameters.Add("@ProfessionalId", SqlDbType.Int).Value     = professional.ProfessionalId;
                    cmd.Parameters.Add("@ProfessionalTypeId", SqlDbType.Int).Value = professional.ProfessionalTypeId;
                    cmd.Parameters.Add("@CompanyId", SqlDbType.Int).Value          = professional.CompanyId;
                    cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value      = professional.FirstName;
                    cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value       = professional.LastName;
                    cmd.Parameters.Add("@Phone", SqlDbType.VarChar).Value          = professional.Phone;
                    cmd.Parameters.Add("@ProfessionalIdentificationNumber", SqlDbType.VarChar).Value = professional.ProfessionalIdentificationNumber;
                    cmd.Parameters.Add("@IsActive", SqlDbType.Bit).Value  = professional.IsActive;
                    cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = professional.UpdatedBy;
                    //cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = DateTime.UtcNow;

                    return(cmd.ExecuteNonQuery() > 0);
                }
            }
        }
Пример #17
0
        /// <summary>
        /// Business Logic Professonal converted to entities class
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public static Professionals MapProfessonal(Professional p, Professionals y = null)
        {
            var accInfo = new AccountInfo();
            var x       = new Professionals
            {
                User = MapUser(p)
            };

            x.Expertise  = p.Category;
            x.YearsOfExp = p.YearsOfExp;
            x.Id         = p.Id;
            if (y == null)
            {
                accInfo.PointAvailable = p.PointAvailable;

                x.AccInfo = accInfo;
            }
            else
            {
                x.AccInfo       = y.AccInfo;
                x.AccountInfoID = y.AccInfo.Id;
                x.Id            = y.Id;
                x.UserID        = y.UserID;
            }

            return(x);
        }
Пример #18
0
        public ServiceResult <Professional> Put(int id, [FromBody] Professional model)
        {
            ServiceResult <Professional> result = null;
            var validatorResult = validator.Validate(model);

            if (validatorResult.IsValid)
            {
                try
                {
                    result = this.appService.Update(model);
                }
                catch (Exception ex)
                {
                    result         = new ServiceResult <Professional>();
                    result.Errors  = new string[] { ex.Message };
                    result.Success = false;
                }
            }
            else
            {
                result         = new ServiceResult <Professional>();
                result.Errors  = validatorResult.GetErrors();
                result.Success = false;
            }

            return(result);
        }
Пример #19
0
 public PlayContext()
 {
     finalState      = new Final();
     primaryState    = new Primary();
     professionState = new Professional();
     secondState     = new Secondary();
 }
Пример #20
0
 protected void btnAccept_Click(object sender, ImageClickEventArgs e)
 {
     if (template != null)
     {
         Patient              patient      = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx);
         Professional         professional = CntAriCli.GetProfessional(int.Parse(rdcProfessional.SelectedValue), ctx);
         IList <TemplateView> ltpw         = new List <TemplateView>();
         TemplateView         tpvw         = new TemplateView();
         tpvw.Name = template.Name;
         string patientName = "";
         if (patient != null)
         {
             patientName = String.Format("{0} {1}, {2}", patient.Surname1, patient.Surname2, patient.Name);
         }
         string professionalName = "";
         if (professional != null)
         {
             professionalName = professional.FullName;
         }
         tpvw.Content = String.Format(template.Content, patientName, professionalName, txtCampo1.Text, txtCampo2.Text, txtCampo3.Text);
         ltpw.Add(tpvw);
         RptTemplate rpt = new RptTemplate(ltpw);
         ReportViewer1.Report = rpt;
     }
 }
 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 == "profInvoice"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     
     // read passed professional if any
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof = CntAriCli.GetProfessional(professionalId, ctx);
     }
     // 
     if (type == "InTab")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         RadGrid1.Columns.FindByDataField("Professional.ComercialName").Visible = false;
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
 }
Пример #22
0
    protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        // weonly process commands with a datasource (our image buttons)
        if (e.CommandSource == null)
        {
            return;
        }
        string typeOfControl = e.CommandSource.GetType().ToString();

        if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton"))
        {
            int         id   = 0;
            ImageButton imgb = (ImageButton)e.CommandSource;
            if (imgb.ID != "New" && imgb.ID != "Exit")
            {
                id = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]];
            }
            switch (imgb.ID)
            {
            case "Select":
                break;

            case "Edit":
                break;

            case "Delete":
                Professional cus = CntAriCli.GetProfessional(id, ctx);
                ctx.Delete(cus);
                ctx.SaveChanges();
                RefreshGrid();
                break;
            }
        }
    }
Пример #23
0
        public async Task <ActionResult <Professional> > PostProfessional(Professional professional)
        {
            _context.Professional.Add(professional);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProfessional", new { id = professional.Id }, professional));
        }
Пример #24
0
        // método que é chamado automaticamente quando se entra na página
        public void OnGet()
        {
            // se o utilizador logado é um cliente
            if (User.IsInRole("Client"))
            {
                // vai buscar o cliente à BD
                Client Client = dbContext.Clients.FirstOrDefault(o => o.UserName.Equals(User.Identity.Name));

                // passa o nome dele para a variável local da página que será mostrada na view
                NameModel = Client.Name;

                // passa o contacto dele para a variável local da página que será mostrada na view
                ContactModel = (int)Client.Contact;
            }

            // se o utilizador logado é um cliente
            if (User.IsInRole("Professional"))
            {
                // vai buscar o profissional à BD
                Professional Professional = dbContext.Professionals.FirstOrDefault(o => o.UserName.Equals(User.Identity.Name));

                // passa o nome dele para a variável local da página que será mostrada na view
                NameModel = Professional.Name;

                // passa o contacto dele para a variável local da página que será mostrada na view
                ContactModel = (int)Professional.Contact;

                // passa o turno dele para a variável local da página que será mostrada na view
                ShiftModel = Professional.Shift;
            }
        }
 protected bool DataOk()
 {
     // check date
     if (rddpInvoiceDate.SelectedDate == null)
     {
         lblMessage.Text = Resources.GeneralResource.DateNeeded;
         return(false);
     }
     // we need the professional in order to do another test
     if (txtProfessionalId.Text == "")
     {
         lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded;
         return(false);
     }
     prof = CntAriCli.GetProfessional(int.Parse(txtProfessionalId.Text), ctx);
     if (prof == null)
     {
         lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded;
         return(false);
     }
     // check if there're invoices with older date
     if (inv == null)
     {
         if (!CntAriCli.CorrectProfessionalInvoiceDate((DateTime)rddpInvoiceDate.SelectedDate, prof))
         {
             lblMessage.Text = Resources.GeneralResource.IncorrectInvoiceDate;
             return(false);
         }
     }
     return(true);
 }
Пример #26
0
        public static void AddNewUser(string firstName, string lastName, DateTime birthDate, User.Gender gender, string email,
                                      string address, string postalCode, string city, string password, string accountType)
        {
            if (accountType == "Volunteer")
            {
                Volunteer currentUser = new Volunteer(firstName, lastName, address, city, postalCode, address, birthDate, gender,
                                                      true, User.AccountType.Volunteer);
            }
            else if (accountType == "Admin")
            {
                Admin currentUser = new Admin(firstName, lastName, address, city, postalCode, address, birthDate, gender,
                                              true, User.AccountType.Admin);
            }
            else if (accountType == "CareRecipient")
            {
                CareRecipient currentUser = new CareRecipient(firstName, lastName, address, city, postalCode, address, birthDate, gender,
                                                              true, User.AccountType.CareRecipient);
            }
            else if (accountType == "Professional")
            {
                Professional currentUser = new Professional(firstName, lastName, address, city, postalCode, address, birthDate, gender,
                                                            true, User.AccountType.Professional);
            }

            string genderString = gender.ToString();

            userRepo.AddNewUser(firstName, lastName, birthDate, genderString, email, address, postalCode, city, password, accountType);
        }
Пример #27
0
        private void ProfessionalData(ProfessionalInvoice Invoice)
        {
            Professional profesional = Invoice.Professional;

            professionalname = profesional.ComercialName;

            foreach (Address item in profesional.Addresses)
            {
                if (item.Type == "Primary")
                {
                    professionaladdress = item;
                }
            }

            foreach (Telephone item in profesional.Telephones)
            {
                if (item.Type == "Primary")
                {
                    professionaltelf = item;
                }
            }

            foreach (Email item in profesional.Emails)
            {
                if (item.Type == "Primary")
                {
                    professionalemail = item;
                }
            }

            professionalnif = profesional.VATIN;
        }
Пример #28
0
        private void ReplaceProfessionalRepository()
        {
            var profissionalRepository = Substitute.For <IProfessionalRepository>();

            var professional = new Professional
            {
                ProfessionalId = 1,
                Name           = "João da Silva",
                Phone          = "99997654",
                Email          = "*****@*****.**",
                Code           = Guid.Parse("1b92f96f-6a71-4655-a0b9-93c5f6ad9637"),
                Address        = new Address("Rua de teste", "321", "APT 32", new ZipCode("87654321"))
            };

            profissionalRepository.GetProfessional(Arg.Is <RequestDto <ComposeKey <Guid, decimal> > >(p => p.GetId().SecundaryKey == 1 && p.GetId().PrimaryKey == Guid.Parse("1b92f96f-6a71-4655-a0b9-93c5f6ad9637")))
            .Returns(professional);

            profissionalRepository.CreateProfessional(Arg.Any <Professional>())
            .Returns(new ComposeKey <Guid, decimal>(Guid.Parse("1b92f96f-6a71-4655-a0b9-93c5f6ad9637"), 1));

            profissionalRepository.UpdateProfessional(Arg.Any <Professional>());

            profissionalRepository.DeleteProfessional(Arg.Is <ComposeKey <Guid, decimal> >(p => p.SecundaryKey == 1 && p.PrimaryKey == Guid.Parse("1b92f96f-6a71-4655-a0b9-93c5f6ad9637")))
            .Returns(true);

            profissionalRepository.ExistsProfessional(Arg.Is <ComposeKey <Guid, decimal> >(p => p.SecundaryKey == 1 && p.PrimaryKey == Guid.Parse("1b92f96f-6a71-4655-a0b9-93c5f6ad9637")))
            .Returns(true);

            IocManager.IocContainer.Register(
                Component.For <IProfessionalRepository>()
                .Instance(profissionalRepository)
                .LifestyleTransient()
                );
        }
        public IActionResult EditProfession(int? id, Professional prof)
        {
            if (id == null)
            {
                return StatusCode(StatusCodes.Status400BadRequest);
            }
            var profession = context_.Professionals.Find(id);

            if (profession != null)
            {
                profession.CompanyName = prof.CompanyName;
                profession.DepartmentName = prof.DepartmentName;
                profession.RoleDescription = prof.RoleDescription;
                profession.TechnologiesUsed = prof.TechnologiesUsed;
                try
                {
                    context_.SaveChanges();
                }
                catch (Exception)
                {
                    // do nothing for now
                }
            }
            return RedirectToAction("Professional");
        }
Пример #30
0
        public async void AddProfessionalAsyncShouldAdd()
        {
            // arrange
            var options = new DbContextOptionsBuilder <PH_DbContext>()
                          .UseInMemoryDatabase("AddProfessionalAsyncShouldAdd")
                          .Options;

            using var actContext = new PH_DbContext(options);
            var repo = new UserRepo(actContext);

            Professional professional = new Professional()
            {
                Email     = "*****@*****.**",
                FirstName = "Rando",
                LastName  = "Random",
                Username  = "******",
                Password  = "******",
                Phone     = "1231231234",
                //Profile_Pic = p.User.Profile_Pic,
                //PointAvailable = p.AccInfo.PointAvailable,
                Category = "Math"
            };

            // act
            await repo.AddProfessionalAsync(professional);

            //actContext.SaveChanges();

            // assert
            using var assertContext = new PH_DbContext(options);
            var member = assertContext.Members.Select(m => professional);

            Assert.NotNull(member);
        }
Пример #31
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // First control the type of parent page
     if (Request.QueryString["HcId"] != null)
     {
         hcId = Int32.Parse(Request.QueryString["HcId"]);
         hc = CntAriCli.GetHealthCompany(ctx);
         caller = "hccom"; // Called by a Healthcare Company
     }
     if (Request.QueryString["ClinicId"] != null)
     {
         clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
         cl = CntAriCli.GetClinic(clinicId, ctx);
         caller = "clinic"; // Called by a Healthcare Company
     }
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat = CntAriCli.GetPatient(patientId, ctx);
         caller = "patient";
     }
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
         caller = "customer";
     }
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof = CntAriCli.GetProfessional(professionalId, ctx);
         caller = "professional";
     }
 }
Пример #32
0
    protected void Page_Init(object sender, EventArgs e)
    {
        ctx = new AriClinicContext("AriClinicContext");
        // security control, This is a general view accesible for all

        // Do you want to see a Diary?
        if (Request.QueryString["DiaryId"] != null)
        {
            diaryId = int.Parse(Request.QueryString["DiaryId"]);
            diary = CntAriCli.GetDiary(diaryId, ctx);
            if (diary != null)
            {
                lblTitle.Text = diary.Name;
                this.Title = diary.Name;
            }
        }
        else
        {
            // this view is only for specific agendas
            Response.Redirect("Default.aspx");
        }
        // Do you want to see a Professional?
        if (Request.QueryString["ProfessionalId"] != null)
        {
            professionalId = int.Parse(Request.QueryString["ProfessionalId"]);
            professional = CntAriCli.GetProfessional(professionalId, ctx);
            if (professional != null)
                lblTitle.Text = professional.FullName;
        }
    }
Пример #33
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // First control the type of parent page
     if (Request.QueryString["HcId"] != null)
     {
         hcId   = Int32.Parse(Request.QueryString["HcId"]);
         hc     = CntAriCli.GetHealthCompany(ctx);
         caller = "hccom"; // Called by a Healthcare Company
     }
     if (Request.QueryString["ClinicId"] != null)
     {
         clinicId = Int32.Parse(Request.QueryString["ClinicId"]);
         cl       = CntAriCli.GetClinic(clinicId, ctx);
         caller   = "clinic"; // Called by a Healthcare Company
     }
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat       = CntAriCli.GetPatient(patientId, ctx);
         caller    = "patient";
     }
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus        = CntAriCli.GetCustomer(customerId, ctx);
         caller     = "customer";
     }
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof           = CntAriCli.GetProfessional(professionalId, ctx);
         caller         = "professional";
     }
 }
Пример #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);
            Process proc = (from p in ctx.Processes
                            where p.Code == "professional"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ProfessionalId"] != null)
        {
            professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
            prof = CntAriCli.GetProfessional(professionalId, ctx);
            LoadData(prof);
        }
        else
        {
            LoadUserCombo(null);
            LoadTypeCombo(null);
            LoadTaxWithholdingTypeCombo(null);
        }

    }
Пример #35
0
        public User getCurrentUserInfo(string email)
        {
            try
            {
                string query =
                    "SELECT UserID, AccountType, FirstName, LastName, Birthdate, Sex, Email, Address, PostalCode, City, Status " +
                    "FROM [User] " +
                    "WHERE Email = @email";

                _conn.Open();
                SqlParameter emailParam = new SqlParameter();
                emailParam.ParameterName = "@email";
                SqlCommand cmd = new SqlCommand(query, _conn);
                emailParam.Value = email;
                cmd.Parameters.Add(emailParam);
                User currentUser = new Admin("a", "b", "c,", "d", "e", "f", Convert.ToDateTime("1988/12/20"), User.Gender.M, true, User.AccountType.CareRecipient);
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string      accountType = reader.GetString(1);
                        User.Gender gender      = (User.Gender)Enum.Parse(typeof(User.Gender), reader.GetString(5));


                        if (accountType == "Admin")
                        {
                            currentUser = new Admin(reader.GetInt32(0), reader.GetString(2), reader.GetString(3), reader.GetString(7), reader.GetString(9), reader.GetString(8), email,
                                                    reader.GetDateTime(4), gender, reader.GetBoolean(10), User.AccountType.Admin);
                        }
                        else if (accountType == "Professional")
                        {
                            currentUser = new Professional(reader.GetInt32(0), reader.GetString(2), reader.GetString(3), reader.GetString(7), reader.GetString(9), reader.GetString(8), email,
                                                           reader.GetDateTime(4), gender, reader.GetBoolean(10), User.AccountType.Professional);
                        }
                        else if (accountType == "Volunteer")
                        {
                            currentUser = new Volunteer(reader.GetInt32(0), reader.GetString(2), reader.GetString(3), reader.GetString(7), reader.GetString(9), reader.GetString(8), email,
                                                        reader.GetDateTime(4), gender, reader.GetBoolean(10), User.AccountType.Volunteer);
                        }
                        else
                        {
                            currentUser = new CareRecipient(reader.GetInt32(0), reader.GetString(2), reader.GetString(3), reader.GetString(7), reader.GetString(9), reader.GetString(8), email,
                                                            reader.GetDateTime(4), gender, reader.GetBoolean(10), User.AccountType.CareRecipient);
                        }
                        return(currentUser);
                    }
                    return(currentUser);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            finally
            {
                _conn.Close();
            }
        }
Пример #36
0
 public void ProfessionnalSuppression( Professional professional )
 {
     List<Follower> followPro = _context.SelectRequest.SelectFollowForPro(professional.ProfessionalId);
     foreach (var follow in followPro)
     {
         FollowerSuppression(follow);
     }
     _context.Professional.Remove(professional);
     _context.SaveChanges();
 }
Пример #37
0
 /// <summary>
 /// Change Role of an professional
 /// </summary>
 /// <param name="Role"> New Role </param>
 /// <param name="Pro"> Professional to modifie </param>
 public void UpdateProInfo(string Role, Professional Pro)
 {
     var professional = _context.Professional.Include("User").Where(s => s.ProfessionalId.Equals(Pro.ProfessionalId)).FirstOrDefault();
     if (professional != null)
     {
         if (professional.Role != Role) UpdateRole(Role, professional);   
     }
     _context.Entry(professional).State = System.Data.Entity.EntityState.Modified;
     _context.SaveChanges();
 }
Пример #38
0
 private void DeleteProfessional(Professional professional, int id)
 {
     _doc = new DocumentManager(_db);
     List<Follower> follow = _db.SelectRequest.SelectFollowForPro(id);
     foreach (var f in follow)
     {
         _doc.DeleteFollowerFile(professional.ProfessionalId, f.Patient.PatientId);
     }
     _db.SuppressionRequest.ProfessionnalSuppression(professional);
 }
Пример #39
0
        /// <summary>
        /// Add a patient into the database 
        /// </summary>
        /// <param name="user"> User can't be null and all property of an user can be null exept userId who it must be null </param>
        /// <param name="role"> Role can't be null and it's the role of the professional </param>
        /// <returns></returns>
        public Professional AddProfessional(User user, string role)
        {
            if (user == null || role == null) throw new ArgumentNullException("user or ", "user can't be null");
            if (user.Adress == null || user.Birthdate == null || user.City == null || user.FirstName == null || user.LastName == null || user.Password == null || user.PhoneNumber == 0 || user.Photo == null || user.Postcode == 0 || user.Pseudo == "null" || user.UserId != 0)
                throw new ArgumentException("All property of an user can't be null exept userId who it must be null");
            Professional p = new Professional()
            {
                Role = role,
                User = user
            };

            _context.User.Add(user);
            _context.Professional.Add(p);
            _context.SaveChanges();

            return p;
        }
Пример #40
0
 private ProfessionalXML CreatePro(Professional pro)
 {
     ProfessionalXML p = new ProfessionalXML();
     p.Adress = pro.User.Adress;
     p.Birthdate = pro.User.Birthdate;
     p.City = pro.User.City;
     p.FirstName = pro.User.FirstName;
     p.LastName = pro.User.LastName;
     p.Password = pro.User.Password;
     p.PhoneNumber = pro.User.PhoneNumber;
     p.PhotoPath = pro.User.Photo;
     p.Photo = _img.ImageCoverter(_img.LoadImage(pro.User.Photo));
     p.Postcode = pro.User.Postcode;
     p.Pseudo = pro.User.Pseudo;
     p.ProfessionalId = pro.User.UserId;
     p.UserId = pro.User.UserId;
     p.Role = pro.Role;
     return p;
 }
Пример #41
0
 public DocumentSerializable SeeDocument(Professional pro, Patient patient)
 {
     DocumentSerializable Documents = DeserializeListDoc(GetPathFile(patient.PatientId + "$" + pro.ProfessionalId));
     return Documents;
 }
 protected bool DataOk()
 {
     // check date
     if (rddpInvoiceDate.SelectedDate == null)
     {
         lblMessage.Text = Resources.GeneralResource.DateNeeded;
         return false;
     }
     // we need the professional in order to do another test
     if (txtProfessionalId.Text == "")
     {
         lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded;
         return false;
     }
     prof = CntAriCli.GetProfessional(int.Parse(txtProfessionalId.Text), ctx);
     if (prof == null)
     {
         lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded;
         return false;
     }
     // check if there're invoices with older date
     if (inv == null)
     {
         if (!CntAriCli.CorrectProfessionalInvoiceDate((DateTime)rddpInvoiceDate.SelectedDate, prof))
         {
             lblMessage.Text = Resources.GeneralResource.IncorrectInvoiceDate;
             return false;
         }
     }
     return true;
 }
Пример #43
0
        /// <summary>
        /// Importa losprofesionales dados de alta en OFT
        /// </summary>
        /// <param name="con">Conector con OFT</param>
        /// <param name="ctx">Contexto para AriClinic</param>
        public static void ImportProfessionals(OleDbConnection con, AriClinicContext ctx)
        {
            //(0) Borrar los professionales que existieran previamente
            //ctx.Delete(ctx.Professionals);

            //(1) Leer los Médicos de OFT
            string sql = "SELECT * FROM Medicos";
            cmd = new OleDbCommand(sql, con);
            da = new OleDbDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds, "ConMedicos");
            int nreg = ds.Tables["ConMedicos"].Rows.Count;
            int reg = 0;
            Professional p = null;
            foreach (DataRow dr in ds.Tables["ConMedicos"].Rows)
            {
                DataRow localDr = dr;
                reg++;
                Console.WriteLine("Profesionales {0:#####0} de {1:#####0} {2}", reg, nreg, (string)localDr["NomMed"]);
                p = (from pf in ctx.Professionals
                     where pf.OftId == (int)localDr["IdMed"]
                     select pf).FirstOrDefault<Professional>();
                if (p == null)
                {
                    p = new Professional();
                    ctx.Add(p);
                }
                p.ComercialName = (string)localDr["NomMed"];
                p.FullName = p.ComercialName;
                p.OftId = (int)localDr["IdMed"];
            }
            ctx.SaveChanges();
        }
Пример #44
0
 protected void LoadProfessionalCombo(Professional professional)
 {
     rdcProfessional.Items.Clear();
     rdcProfessional.Items.Add(new RadComboBoxItem(professional.FullName, professional.PersonId.ToString()));
     rdcProfessional.SelectedValue = professional.PersonId.ToString();
 }
Пример #45
0
 protected void LoadTaxWithholdingTypeCombo(Professional prof)
 {
     rdcbTaxWithholding.Items.Clear();
     foreach (TaxWithholdingType t in ctx.TaxWithholdingTypes)
     {
         rdcbTaxWithholding.Items.Add(new RadComboBoxItem(t.Name, t.TaxWithholdingTypeId.ToString()));
     }
     rdcbTaxWithholding.Items.Add(new RadComboBoxItem(" ", ""));
     if (prof != null && prof.TaxWithholdingType != null)
     {
         rdcbTaxWithholding.SelectedValue = prof.TaxWithholdingType.TaxWithholdingTypeId.ToString();
     }
     else
     {
         rdcbTaxWithholding.SelectedValue = "";
     }
 }
Пример #46
0
    protected void UnloadData(Professional prof)
    {
        prof.FullName = txtFullName.Text;
        prof.VATIN = txtVATIN.Text;
        prof.ComercialName = txtComercialName.Text;
        prof.Type = rdcbType.SelectedValue;
        if (rdcbUser.SelectedValue != "")
        {
            int id = Int32.Parse(rdcbUser.SelectedValue);
            prof.User = CntAriCli.GetUser(id, ctx);
        }
        else
            prof.User = null;

        prof.License = txtLicense.Text;
        
        if (rdcbTaxWithholding.SelectedValue != "")
        {
            int id = Int32.Parse(rdcbTaxWithholding.SelectedValue);
            prof.TaxWithholdingType = CntAriCli.GetTaxWithholdingType(id, ctx);
        }
        
        prof.InvoiceSerial = txtInvoiceSerial.Text;
        
        if (txtCommision.Text != "")
            prof.Commission = Decimal.Parse(txtCommision.Text);
    }
Пример #47
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 (professionalId == 0)
     {
         prof = new Professional();
         UnloadData(prof);
         ctx.Add(prof);
     }
     else
     {
         prof = CntAriCli.GetProfessional(professionalId, ctx);
         UnloadData(prof);
     }
     ctx.SaveChanges();
     return true;
 }
Пример #48
0
 protected void txtProfessionalId_TextChanged(object sender, EventArgs e)
 {
     professionalId = Int32.Parse(txtProfessionalId.Text);
     prof = CntAriCli.GetProfessional(professionalId, ctx);
     if (prof != null)
     {
         txtProfessionalId.Text = prof.PersonId.ToString();
         txtProfessionalName.Text = prof.FullName;
     }
     else
     {
         txtProfessionalId.Text = "";
         txtProfessionalName.Text = Resources.GeneralResource.ProfessionalDoesNotExists;
     }
 }
Пример #49
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);
     }
 }
Пример #50
0
        private Tuple<Patient, Professional[]> ProAdd(List<Follower> result, Patient p)
        {
            Professional[] proArray = new Professional[10];
            Tuple<Patient, Professional[]> Follows;
            int x = 0;

            foreach (var follow in result)
            {

                if (follow.PatientId == p.PatientId)
                {
                    proArray.SetValue(follow.Professionnal, x);
                    x++;
                }
            }
            Follows = Tuple.Create(p, proArray);
            return Follows;
        }
Пример #51
0
 private ProfessionalXML[] CreateProArray(Professional[] pro)
 {
     ProfessionalXML[] p = new ProfessionalXML[pro.Length];
     for (int i = 0; i < pro.Length; i++)
     {
         if (pro[i] == null)
             p.SetValue(null, i);
         else
             p.SetValue(CreatePro(pro[i]), i);
     }
     return p;
 }
Пример #52
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);
     }
 }
Пример #53
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 = (User)Session["User"];
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "treatment"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
            if (user.Professionals.Count > 0)
            {
                professional = user.Professionals[0];
                rdcProfessional.Items.Clear();
                rdcProfessional.Items.Add(new RadComboBoxItem(professional.FullName, professional.PersonId.ToString()));
                rdcProfessional.SelectedValue = professional.PersonId.ToString();
            }
        }

        // 
        if (Request.QueryString["TreatmentId"] != null)
        {
            treatmentId = Int32.Parse(Request.QueryString["TreatmentId"]);
            treatment = CntAriCli.GetTreatment(treatmentId, ctx);
            LoadData(treatment);
        }
        else
        {
            rdpTreatmentDate.SelectedDate = DateTime.Now;
            if (Session["Professional"] != null) LoadProfessionalCombo((Professional)Session["Professional"]);
        }
        //
        if (Request.QueryString["PatientId"] != null)
        {
            patientId = int.Parse(Request.QueryString["PatientId"]);
            patient = CntAriCli.GetPatient(patientId, ctx);
            // fix rdc with patient
            rdcPatient.Items.Clear();
            rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName, patient.PersonId.ToString()));
            rdcPatient.SelectedValue = patient.PersonId.ToString();
        }
        //
        if (Request.QueryString["VisitId"] != null)
        {
            visitId = int.Parse(Request.QueryString["VisitId"]);
            visit = CntAriCli.GetVisit(visitId, ctx);
            patientId = visit.Patient.PersonId;
            patient = CntAriCli.GetPatient(patientId, ctx);
            // fix rdc with patient
            rdcPatient.Items.Clear();
            rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName, patient.PersonId.ToString()));
            rdcPatient.SelectedValue = patient.PersonId.ToString();
            //
            rdpTreatmentDate.SelectedDate = visit.VisitDate;
            LoadProfessionalCombo(visit.Professional);
        }

    }
Пример #54
0
 protected void LoadComboProfesional(Professional professional)
 {
     if (professional == null) return; // do nothing
     rdcProfessional.Items.Clear();
     rdcProfessional.Items.Add(new RadComboBoxItem(professional.FullName, professional.PersonId.ToString()));
     rdcProfessional.SelectedValue = professional.PersonId.ToString();
 }
Пример #55
0
 protected void LoadData(Professional prof)
 {
     txtProfessionalId.Text = prof.PersonId.ToString();
     txtFullName.Text = prof.FullName;
     txtVATIN.Text = prof.VATIN;
     txtComercialName.Text = prof.ComercialName;
     LoadTypeCombo(prof);
     LoadUserCombo(prof.User);
     txtLicense.Text = prof.License;
     LoadTaxWithholdingTypeCombo(prof);
     txtCommision.Text = String.Format("{0:##0.00}", prof.Commission);
     txtInvoiceSerial.Text = prof.InvoiceSerial;
 }
Пример #56
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 = (User)Session["User"];
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "visit"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
            if (user.Professionals.Count > 0)
            {
                professional = user.Professionals[0];
                LoadComboProfesional(professional);
            }
        }

        // 
        if (Request.QueryString["VisitId"] != null)
        {
            visitId = Int32.Parse(Request.QueryString["VisitId"]);
            visit = CntAriCli.GetVisit(visitId, ctx);
            LoadData(visit);
        }
        else
        {
            rdpVisitDate.SelectedDate = DateTime.Now;
            // load professional
            if (Session["Professional"] != null) LoadComboProfesional((Professional)Session["Professional"]);
            // called from an appointment?
            if (Request.QueryString["AppointmentId"] != null) 
            {
                app = CntAriCli.GetAppointment(int.Parse(Request.QueryString["AppointmentId"]), ctx);
                if (app != null)
                {
                    Patient pat = app.Patient;
                    rdcPatient.Items.Clear();
                    rdcPatient.Items.Add(new RadComboBoxItem(pat.FullName, pat.PersonId.ToString()));
                    rdcPatient.SelectedValue = pat.PersonId.ToString();
                    //
                    rdpVisitDate.SelectedDate = app.BeginDateTime;
                    //
                    LoadComboProfesional(app.Professional);
                    //
                    AppointmentType appt = app.AppointmentType;
                    rdcAppointmentType.Items.Clear();
                    rdcAppointmentType.Items.Add(new RadComboBoxItem(appt.Name, appt.AppointmentTypeId.ToString()));
                    rdcAppointmentType.SelectedValue = appt.AppointmentTypeId.ToString();
                    //
                    fromAppointment = true;
                }
            }
        }
        //
        if (Request.QueryString["PatientId"] != null)
        {
            patientId = int.Parse(Request.QueryString["PatientId"]);
            patient = CntAriCli.GetPatient(patientId, ctx);
            // fix rdc with patient
            rdcPatient.Items.Clear();
            rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName,patient.PersonId.ToString()));
            rdcPatient.SelectedValue = patient.PersonId.ToString();
            rdcPatient.Enabled = false;
        }
        //
        if (Request.QueryString["Type"] != null)
        {
            type = Request.QueryString["Type"];
            if (type == "InTab")
            {
                HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
                tt.Attributes["class"] = "ghost";
            }
        }
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
        }
    }
Пример #57
0
 protected void LoadTypeCombo(Professional prof)
 {
     rdcbType.Items.Clear();
     rdcbType.Items.Add(new RadComboBoxItem(Resources.ConstantsResource.Internal, "I"));
     rdcbType.Items.Add(new RadComboBoxItem(Resources.ConstantsResource.External, "E"));
     if (prof != null)
         rdcbType.SelectedValue = prof.Type;
 }
Пример #58
0
 private void UpdateRole(string Role, Professional Professional)
 {
     Professional.Role = Role;
 }
Пример #59
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);
     }
 }
Пример #60
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);
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "appointment"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
            if (user.Professionals.Count > 0)
                professional = user.Professionals[0];
        }
        if (Request.QueryString["DiaryId"] != null)
        {
            // Diary passed
            Diary dia = CntAriCli.GetDiary(int.Parse(Request.QueryString["DiaryId"]), ctx);
            if (dia != null)
            {
                LoadDiaryCombo(dia);
            }
        }
        if (Request.QueryString["PatientId"] != null)
        {
            // Patient passed
            Patient pat = CntAriCli.GetPatient(int.Parse(Request.QueryString["PatientId"]), ctx);
            LoadPatientCombo(pat);
        }
        if (Request.QueryString["AppointmentId"] != null)
        {
            appId = int.Parse(Request.QueryString["AppointmentId"]);
            app = CntAriCli.GetAppointment(appId, ctx);
        }

        LoadData(app);

        // Must be check after load data.
        if (Request.QueryString["BeginDateTime"] != null)
        {
            beginDateTime = GetCorrectDateTime(Request.QueryString["BeginDateTime"]);
            rddtBeginDateTime.SelectedDate = beginDateTime;
        }
        if (Request.QueryString["EndDateTime"] != null)
        {
            endDateTime = GetCorrectDateTime(Request.QueryString["EndDateTime"]);
            rddtEndDateTime.SelectedDate = endDateTime;
            // TODO: Recalculate duration.
        }
        // Appointement moved
        if (beginDateTime != null && app != null)
        {
            DateTime bt = (DateTime)beginDateTime;
            DateTime et = bt.AddMinutes(app.Duration);
            rddtEndDateTime.SelectedDate = et;
        }
        // Appintment resized
        if (beginDateTime != null && endDateTime != null)
        {
            DateTime bt = (DateTime)beginDateTime;
            DateTime et = (DateTime)endDateTime;
            TimeSpan t = et.Subtract(bt);
            int d = t.Minutes + (t.Hours * 60);
            txtDuration.Text = d.ToString();
        }
    }