public bool SavePersonalInformation(PersonalInformationModel personalInformationModel)
 {
     try
     {
         PersonalInformation personalInformation = new PersonalInformation()
         {
             EnglishName = personalInformationModel.EnglishName,
             BanglaName  = personalInformationModel.BanglaName,
             //DepartmentId = personalInformationModel.Departments.Id,
         };
         if (personalInformationModel.Departments != null)
         {
             personalInformation.Departments = new Department()
             {
                 DepartmentName = personalInformationModel.Departments.DepartmentName
             };
         }
         _dbContext.PersonalInformations.Add(personalInformation);
         _dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         string val = ex.Message;
         return(false);
     }
 }
Beispiel #2
0
        public IHttpActionResult PostPersonalInformations(PersonalInformationModel model)
        {
            try
            {
                _logger.Debug(string.Format("ini process - Post,idUser:{0}", CurrentIdUser));

                if (!ModelState.IsValid)
                {
                    _logger.Debug(string.Format("ini Post - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest(ModelState));
                }

                PersonalInformation personalinformation = AutoMapper.Mapper.Map <PersonalInformation>(model);
                personalinformation.LastActivityIdUser = CurrentIdUser;
                personalinformation.CreationIdUser     = CurrentIdUser;

                _personalinformationBL.Insert(personalinformation);
                _logger.Debug(string.Format("finish Post - success,idUser:{0}", CurrentIdUser));

                return(Ok(new JsonResponse {
                    Success = true, Message = "PersonalInformation was Saved successfully", Data = personalinformation
                }));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(InternalServerError(ex));
            }
        }
        public PersonalInformationModel SearchByMobile(string mobileNumber)
        {
            PersonalInformationModel aModel = new PersonalInformationModel();

            Query = "SELECT MAX(Contact) Contact,  SUM(TotalDue) AS TotalDue,  MAX(DueDate) DueDate FROM PaymentView WHERE Contact = '" + mobileNumber + "'";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();

            while (Reader.Read())
            {
                aModel.MobileNo = Reader["Contact"].ToString();

                if (Reader["TotalDue"] == DBNull.Value)
                {
                    aModel.TotalBill = 0;
                }
                else
                {
                    aModel.TotalBill = Convert.ToDecimal(Reader["TotalDue"]);
                }

                aModel.PatientEntryDate = Reader["DueDate"].ToString();
            }

            Reader.Close();
            Connection.Close();

            return(aModel);
        }
        public PersonalInformationModel SearchByBillNumber(double billNumber)
        {
            PersonalInformationModel aModel = new PersonalInformationModel();

            Query = "SELECT Contact, BillNo, TotalDue, DueDate FROM PaymentView WHERE BillNo ='" + billNumber + "'";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();

            while (Reader.Read())
            {
                aModel.MobileNo         = Reader["Contact"].ToString();
                aModel.TotalBill        = Convert.ToDecimal(Reader["TotalDue"]);
                aModel.PatientEntryDate = Reader["DueDate"].ToString();
                aModel.BillNumber       = Convert.ToDouble(Reader["BillNo"]);
            }

            Reader.Close();
            Connection.Close();

            return(aModel);
        }
Beispiel #5
0
        public int SaveTestData(TestNameModel test)
        {
            PersonalInformationModel aInformationModel = new PersonalInformationModel();


            aInformationModel.Id = GetPatientTestId();
            test.Id = GetTestId(test);

            Query = "INSERT INTO PatientTest VALUES (@patientId, @testId, @entryDate)";

            Command = new SqlCommand(Query, Connection);

            Command.Parameters.Clear();
            Command.Parameters.Add("patientId", SqlDbType.Int);
            Command.Parameters["patientId"].Value = aInformationModel.Id;


            Command.Parameters.Add("testId", SqlDbType.Int);
            Command.Parameters["testId"].Value = test.Id;


            Command.Parameters.Add("entryDate", SqlDbType.Date);
            Command.Parameters["entryDate"].Value = test.EntryDate;

            Connection.Open();

            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowAffected);
        }
 public bool UpdatePersonalInformation(PersonalInformationModel personalInformationModel)
 {
     try
     {
         var personalInformation = _dbContext.PersonalInformations.Find(personalInformationModel.Id);
         if (personalInformation != null)
         {
             personalInformation.BanglaName  = personalInformationModel.BanglaName;
             personalInformation.EnglishName = personalInformationModel.EnglishName;
             if (personalInformationModel.Departments != null)
             {
                 var department = _dbContext.Departments.Find(personalInformation.DepartmentId);
                 department.DepartmentName = personalInformationModel.Departments.DepartmentName;
                 //var department = _dbContext.Departments.Find(personalInformation.DepartmentId);
                 //personalInformation.Departments = new Department() {
                 //    Id = personalInformation.DepartmentId,
                 //    DepartmentName = personalInformationModel.Departments.DepartmentName
                 //};
             }
         }
         _dbContext.Entry(personalInformation).State = System.Data.Entity.EntityState.Modified;
         _dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #7
0
        public int SavePatientInfo(PersonalInformationModel person)
        {
            Query = "SELECT COUNT(BillNo) AS Count FROM PatientInfo";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();

            int countRows = 0;

            while (Reader.Read())
            {
                countRows = Convert.ToInt32(Reader["Count"]);
            }

            Reader.Close();
            Connection.Close();

            if (countRows > 0)
            {
                Query =
                    " declare @BillNo int  set @BillNo= 1 + ( select max(PatientInfo.BillNo) from PatientInfo) INSERT INTO PatientInfo VALUES( @BillNo, @patientName, @contact, @dob, @totalDue)";
            }

            else
            {
                Query = "INSERT INTO PatientInfo VALUES( '443300001', @patientName, @contact, @dob, @totalDue)";
            }


            Command = new SqlCommand(Query, Connection);

            Command.Parameters.Clear();
            Command.Parameters.Add("patientName", SqlDbType.VarChar);
            Command.Parameters["patientName"].Value = person.PatientName;

            Command.Parameters.Add("contact", SqlDbType.VarChar);
            Command.Parameters["contact"].Value = person.MobileNo;

            Command.Parameters.Add("dob", SqlDbType.DateTime);
            Command.Parameters["dob"].Value = person.BirthDate;

            Command.Parameters.Add("totalDue", SqlDbType.Decimal);
            Command.Parameters["totalDue"].Value = person.TotalBill;


            Connection.Open();

            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowAffected);
        }
        public ActionResult Index(HttpPostedFileBase Icon)
        {
            PersonalInformationModel model = _personalInforService.GetPersonalInforModelById((int)currentId);
            string urlPath  = "/Images";
            string iconName = Guid.NewGuid().ToString() + Path.GetExtension(Icon.FileName);

            Icon.SaveAs(Server.MapPath(urlPath) + "\\" + iconName);
            model.IconPath = urlPath + "/" + iconName;
            _personalInforService.AddModelIcon(model);
            return(View(model));
        }
        public ActionResult Personal(PersonalInformationModel model)
        {
            if (!User.Identity.IsAuthenticated)
            {
                throw new SecurityException("Access denied. Not authenticated.");
            }

            if (ModelState.IsValid)
            {
            }

            return(RedirectToAction("Index", "Profile"));
        }
        public JsonResult Save(PersonalInformationModel personalInformation, bool isInsert)
        {
            if (isInsert)
            {
                personalInformation.SetCreateProperties(LoginInformation.UserInformation.Id);
                personalInformation.Id = _personalInformationService.Insert(personalInformation);
            }
            else
            {
                personalInformation.SetUpdateProperties(LoginInformation.UserInformation.Id);
                _personalInformationService.Update(personalInformation);
            }

            foreach (string file in Request.Files)
            {
                var hpf = Request.Files[file] as HttpPostedFileBase;
                if (hpf.ContentLength == 0)
                {
                    continue;
                }

                string savedFileName = Path.Combine(Server.MapPath("~/App_Data"), Path.GetFileName(hpf.FileName));
                hpf.SaveAs(savedFileName); // Save the file

                //r.Add(new ViewDataUploadFilesResult()
                //{
                //    Name = hpf.FileName,
                //    Length = hpf.ContentLength,
                //    Type = hpf.ContentType
                //});
            }

            personalInformation.Address.PersonId = personalInformation.Id;

            if (personalInformation.Address.Id == 0)
            {
                personalInformation.Address.SetCreateProperties(LoginInformation.UserInformation.Id);
                _addressService.Insert(personalInformation.Address);
            }
            else
            {
                personalInformation.Address.SetUpdateProperties(LoginInformation.UserInformation.Id);
                _addressService.Update(personalInformation.Address);
            }

            return(new JsonResult {
                Data = _personalInformationService.GetById(personalInformation.Id)
            });
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            PatientInformationManager aManager = new PatientInformationManager();

            PersonalInformationModel person = new PersonalInformationModel();

            TestNameModel test = new TestNameModel();

            person.PatientName      = patientNameTextBox.Text;
            person.BirthDate        = datepicker.Value;
            person.MobileNo         = mobileNoTextBox.Text;
            person.TotalBill        = Convert.ToDecimal(totalTextBox.Text);
            person.PatientEntryDate = DateTime.Today.ToString("yyyy-MM-dd");

            messageShowlabel.Text = aManager.SavePatientInfo(person);

            List <TestNameModel> aTestNameModels = new List <TestNameModel>();

            testSelectGridView.DataSource = aTestNameModels;
            testSelectGridView.DataBind();

            List <TestNameModel> types = aTestManager.GetAllTypes();

            testSelectDropDownList.DataSource     = types;
            testSelectDropDownList.DataTextField  = "TestName";
            testSelectDropDownList.DataValueField = "Id";
            testSelectDropDownList.DataBind();


            totalTextBox.Text = "0.00";
            testSelectDropDownList.Items.Insert(0, new ListItem("--- Please Select ---", ""));

            test.EntryDate = DateTime.Today.ToString("yyyy-MM-dd");


            foreach (GridViewRow row in testSelectGridView.Rows)
            {
                test.TestName = ((Label)row.FindControl("nameLabel")).Text;
                test.Fee      = Convert.ToDecimal(((Label)row.FindControl("feeLabel")).Text);
                aManager.SaveTestData(test);
            }

            patientNameTextBox.Text = "";
            datepicker.Value        = "";
            mobileNoTextBox.Text    = "";
            totalTextBox.Text       = "";
            feeTextBox.Text         = "";
        }
Beispiel #12
0
 public ActionResult Edit(PersonalInformationModel personalInformationModel)
 {
     if (ModelState.IsValid & personalInformationModel != null)
     {
         bool update = _personalInformationRepo.UpdatePersonalInformation(personalInformationModel);
         if (update)
         {
             TempData["PersonalInformationUpdate"] = "Successfully Update";
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.PersonalInformationUpdate = "Not Save";
             return(View());
         }
     }
     return(View());
 }
Beispiel #13
0
 public ActionResult Create(PersonalInformationModel personalInformationModel)
 {
     if (ModelState.IsValid & personalInformationModel != null)
     {
         bool insert = _personalInformationRepo.SavePersonalInformation(personalInformationModel);
         if (insert)
         {
             TempData["PersonalInformationSuccess"] = "Successfully Save";
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.PersonalInformationSuccess = "Not Save";
             return(View());
         }
     }
     return(View());
 }
        protected void payButton_Click(object sender, EventArgs e)
        {
            PersonalInformationModel aPerson = new PersonalInformationModel();

            string payMessage = hideSomething.Value;

            if (payMessage == "Bill")
            {
                aPerson.BillNumber = Convert.ToDouble(hideObject.Value);

                messageLabel.Text = aPaymentManager.PayByBillNumber(aPerson.BillNumber);
            }

            else
            {
                aPerson.MobileNo = hideObject.Value;

                messageLabel.Text = aPaymentManager.PayByMobile(aPerson.MobileNo);
            }
        }
        protected void searchButton_Click(object sender, EventArgs e)
        {
            PersonalInformationModel aPerson = new PersonalInformationModel();

            string hiddenMessage = hideSomething.Value;

            if (hiddenMessage == "Bill")
            {
                aPerson.BillNumber = Convert.ToDouble(billNoTextBox.Text);

                aPerson = aPaymentManager.SearchByBillNumber(aPerson.BillNumber);

                amountTextBox.Text  = aPerson.TotalBill.ToString();
                dueDateTextBox.Text = aPerson.PatientEntryDate;
                hideObject.Value    = aPerson.BillNumber.ToString();
            }

            else
            {
                aPerson.MobileNo = mobileNoTextBox.Text;

                aPerson = aPaymentManager.SearchByMobile(aPerson.MobileNo);

                amountTextBox.Text  = aPerson.TotalBill.ToString();
                dueDateTextBox.Text = aPerson.PatientEntryDate;
                hideObject.Value    = aPerson.MobileNo;
            }


            if (aPerson.TotalBill == 0)
            {
                payButton.Enabled = false;
            }

            else
            {
                payButton.Enabled = true;
            }

            messageLabel.Text = "";
        }
        public async Task <bool> ChangeUserInformation(PersonalInformationModel personalInformationModel)
        {
            var data = new
            {
                username = personalInformationModel.Username,
                password = personalInformationModel.Password,
                email    = personalInformationModel.Email,
                token    = personalInformationModel.Token
            };

            var client        = GetClient();
            var stringContent = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");

            var result = await client.PostAsync(Constants.Constants.UpdateInformationUri, stringContent);

            if (result.IsSuccessStatusCode)
            {
                var body = await result.Content.ReadAsStringAsync();

                var token = await Task.Run(() => JsonConvert.DeserializeObject <LoginModel>(body));


                App.user = new Models.User
                {
                    Username = personalInformationModel.Username,
                    Token    = token.AuthToken,
                    Email    = token.Email
                };

                App.settings.Email    = token.Email;
                App.settings.Username = personalInformationModel.Username;
                App.settings.Password = personalInformationModel.Password;
                App.SettingsDatabase.SaveSettingsAsync(App.settings);
                App.Token = token.AuthToken;

                return(true);
            }
            return(false);
        }
Beispiel #17
0
 public async System.Threading.Tasks.Task <int> SaveSettingsAsync(Settings settingsParam, bool personalInformationChanged = false)
 {
     if (settingsParam.Id != 0)
     {
         database.Update(settingsParam);
         if (personalInformationChanged)
         {
             Settings setting = this.GetSettings();
             User     user    = App.UserDatabase.GetUser();
             PersonalInformationModel personalInformationModel = new PersonalInformationModel
             {
                 Username = setting.Username,
                 Email    = setting.Email,
                 Password = setting.Password,
                 Token    = user.Token
             };
             await userService.ChangeUserInformation(personalInformationModel);
         }
         return(settingsParam.Id);
     }
     else
     {
         settingsParam.Id = 1;
         if (personalInformationChanged)
         {
             Settings setting = this.GetSettings();
             User     user    = App.UserDatabase.GetUser();
             PersonalInformationModel personalInformationModel = new PersonalInformationModel
             {
                 Username = setting.Username,
                 Email    = setting.Email,
                 Password = setting.Password,
                 Token    = user.Token
             };
             await userService.ChangeUserInformation(personalInformationModel);
         }
         return(database.Insert(settingsParam));
     }
 }
Beispiel #18
0
        public IHttpActionResult PutPersonalInformations(int id, PersonalInformationModel model)
        {
            try
            {
                _logger.Debug(string.Format("ini process - Put,idUser:{0}", CurrentIdUser));

                if (id != model.Id)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest("Invalid ID"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest(ModelState));
                }

                _logger.Debug(string.Format("ini update ,idUser: {0}, modelId update: {1}", CurrentIdUser, id));

                PersonalInformation personalinformation = AutoMapper.Mapper.Map <PersonalInformation>(model);

                personalinformation.LastActivityIdUser = CurrentIdUser;

                _personalinformationBL.Update(personalinformation);

                _logger.Debug(string.Format("finish Put - success,idUser:{0}", CurrentIdUser));

                return(Ok(new JsonResponse {
                    Success = true, Message = "PersonalInformation was Saved successfully", Data = personalinformation
                }));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(InternalServerError(ex));
            }
        }
Beispiel #19
0
        public double GetBillNumber()
        {
            PersonalInformationModel aPerson = new PersonalInformationModel();

            Query = "SELECT MAX(BillNo) AS BillNumber FROM PatientInfo";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();


            while (Reader.Read())
            {
                aPerson.BillNumber = Convert.ToDouble(Reader["BillNUmber"]);
            }

            Reader.Close();
            Connection.Close();

            return(aPerson.BillNumber);
        }
        public string SavePatientInfo(PersonalInformationModel person)
        {
            bool hasRows = aGateway.IsMobileExists(person.MobileNo);

            if (!hasRows)
            {
                int row = aGateway.SavePatientInfo(person);

                if (row > 0)
                {
                    return("Saved Successfully");
                }
                else
                {
                    return("Failed");
                }
            }

            else
            {
                MobileExists = true;
                return("Mobile Number exists already");
            }
        }
        public IActionResult Put(string id, [FromBody] PersonalInformationModel per)
        {
            var person = _repo.UpdateDocumentFromCollection(id, per);

            return(Ok(person.Result));
        }
        public void AddModelIcon(PersonalInformationModel model)
        {
            User user = mapper.Map <User>(model);

            userRepository.UserSaveChanges(user);
        }
        // GET: PersonalInformation
        public ActionResult Index()
        {
            PersonalInformationModel model = _personalInforService.GetPersonalInforModelById((int)currentId);

            return(View(model));
        }
        public IActionResult Post([FromBody] PersonalInformationModel per)
        {
            var person = _repo.AddDocumentIntoCollectionAsync(per).Result;

            return(Ok(person));
        }