コード例 #1
0
        public AdmissionVM GetSingaporeAdmissionByReferenceNo(string refNo)
        {
            try
            {
                var singaporeAdmissions = unitOfWork.tblAdmission_Singapore.Get(x => x.ReferenceNo == refNo).ToList();
                var AdmissionVM         = new AdmissionVM();
                if (singaporeAdmissions != null)
                {
                    AdmissionVM.ReferenceNo                  = singaporeAdmissions[0].ReferenceNo;
                    AdmissionVM.PatientName                  = singaporeAdmissions[0].PatientName;
                    AdmissionVM.DateOfBirth                  = singaporeAdmissions[0].DateOfBirth.ToString();
                    AdmissionVM.PassportNumber               = singaporeAdmissions[0].PassportNumber;
                    AdmissionVM.Scheme                       = singaporeAdmissions[0].Scheme.Trim();
                    AdmissionVM.InimatedDate                 = singaporeAdmissions[0].InimatedDate.ToString();
                    AdmissionVM.InceptionDate                = singaporeAdmissions[0].InceptionDate.ToString();
                    AdmissionVM.Deductible                   = singaporeAdmissions[0].Deductible == null?0:(decimal)singaporeAdmissions[0].Deductible;
                    AdmissionVM.DeductibleUsedForTheYear     = singaporeAdmissions[0].DeductibleForTheYear == null ? 0 : singaporeAdmissions[0].DeductibleForTheYear == null ? 0 : (decimal)singaporeAdmissions[0].DeductibleForTheYear;
                    AdmissionVM.Exclusions                   = singaporeAdmissions[0].Exclusions == null ? 0 : (decimal)singaporeAdmissions[0].Exclusions;
                    AdmissionVM.Hospital                     = singaporeAdmissions[0].Hospital == null ? "" : singaporeAdmissions[0].Hospital.Trim();
                    AdmissionVM.AdmissionDate                = singaporeAdmissions[0].AdmissionDate == null ? "" : singaporeAdmissions[0].AdmissionDate.ToString();
                    AdmissionVM.DischargedDate               = singaporeAdmissions[0].DischargeDate == null ? "" : singaporeAdmissions[0].DischargeDate.ToString();
                    AdmissionVM.CaseNumber                   = singaporeAdmissions[0].CaseNumber == null ? "" : singaporeAdmissions[0].CaseNumber;
                    AdmissionVM.Illness                      = singaporeAdmissions[0].Illness == null ? "" : singaporeAdmissions[0].Illness.Trim();
                    AdmissionVM.ConsultantName               = singaporeAdmissions[0].ConsultantName == null ? "" : singaporeAdmissions[0].ConsultantName.Trim();
                    AdmissionVM.InformedBy                   = singaporeAdmissions[0].InformedBy == null ? "" : singaporeAdmissions[0].InformedBy.Trim();
                    AdmissionVM.GOPAmount                    = singaporeAdmissions[0].GOPAmount == null ? 0 : (decimal)singaporeAdmissions[0].GOPAmount;
                    AdmissionVM.ExtendedGOP                  = singaporeAdmissions[0].ExtendedGOP == null ? 0 : (decimal)singaporeAdmissions[0].ExtendedGOP;
                    AdmissionVM.FinalAmount                  = singaporeAdmissions[0].FinalAmount == null ? 0 : (decimal)singaporeAdmissions[0].FinalAmount;
                    AdmissionVM.ConsultantFee                = singaporeAdmissions[0].ConsultantFee == null ? 0 : (decimal)singaporeAdmissions[0].ConsultantFee;
                    AdmissionVM.FinalAmount                  = singaporeAdmissions[0].FinalAmount == null ? 0 : (decimal)singaporeAdmissions[0].FinalAmount;
                    AdmissionVM.FinalBillAmount              = singaporeAdmissions[0].FinalAmount == null ? 0 : (decimal)singaporeAdmissions[0].FinalAmount;
                    AdmissionVM.ExtendedGOPDate              = singaporeAdmissions[0].AdmissionDate == null ? "" : singaporeAdmissions[0].ExtendedGOPDate.ToString();
                    AdmissionVM.FinalBillRecievedDate        = singaporeAdmissions[0].FinalBillReceivedDate == null ? "" : singaporeAdmissions[0].FinalBillReceivedDate.ToString();
                    AdmissionVM.PaymentGivenToAccount        = singaporeAdmissions[0].PaymentGivenToAccount == null ? 0 : (decimal)singaporeAdmissions[0].PaymentGivenToAccount;
                    AdmissionVM.ReferalFee                   = singaporeAdmissions[0].ReferalFee == null ? 0 : (decimal)singaporeAdmissions[0].ReferalFee;
                    AdmissionVM.CMAInvoiceNumber             = singaporeAdmissions[0].CMAInvoiceNumber.Trim();
                    AdmissionVM.ReferalFeeReceivedDate       = singaporeAdmissions[0].ReferalFeeReceivedDate == null ? "" : singaporeAdmissions[0].ReferalFeeReceivedDate.ToString();
                    AdmissionVM.ReferalFeeReceivedTtTransfer = singaporeAdmissions[0].ReferalFeeReceivedTTNo == null ? "" : singaporeAdmissions[0].ReferalFeeReceivedTTNo; // Doubt
                    AdmissionVM.Remark                       = singaporeAdmissions[0].Remark == null ? "" : singaporeAdmissions[0].Remark.Trim();
                    AdmissionVM.DeductionID                  = singaporeAdmissions[0].PatientName == null ? 0: int.Parse(singaporeAdmissions[0].PatientName);
                }


                return(AdmissionVM);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public IActionResult ViewAdmissionList()
        {
            var acc = db.Admission;
            var i   = new List <AdmissionVM>();

            foreach (var s in acc)
            {
                AdmissionVM t = new AdmissionVM();
                t.AdmissionId   = s.AdmissionId;
                t.StudentId     = s.StudentId;
                t.AdmissionFees = s.AdmissionFees;
                t.LibraryFee    = s.LibraryFee;
                t.LaboratoryFee = s.LaboratoryFee;
                t.FixedAmount   = s.FixedAmount;
                t.PayAmount     = t.AdmissionFees + t.LibraryFee + t.LaboratoryFee;
                t.PaymentStatus = t.FixedAmount - t.PayAmount;
                i.Add(t);
            }
            return(View(i));
        }
コード例 #3
0
        public ActionResult Create(AdmissionVM viewModel, HttpPostedFileBase StudentImage, HttpPostedFileBase Document)
        {
            using (var dbTransaction = db.Database.BeginTransaction())
            {
                try
                {
                    #region validation
                    //if (!ModelState.IsValid)
                    //{
                    //    var studentClass = db.StudentClass.Select(c => new
                    //    {
                    //        Id = c.Id,
                    //        Name = c.ClassName.Name + " || " + c.Shift.Name + " ||" + c.Section.Name
                    //    }).OrderBy(o => o.Name).ToList();

                    //    ViewBag.SessionId = new SelectList(db.Session, "Id", "Name");
                    //    ViewBag.GuardianTypeId = new SelectList(db.GuardianType, "Id", "Name");
                    //    ViewBag.StudentClassId = new SelectList(studentClass, "Id", "Name");
                    //    ViewBag.GroupId = new SelectList(db.Group, "Id", "Name");
                    //    return View();
                    //}
                    #endregion

                    #region Create Students

                    var student = new Student
                    {
                        Name             = viewModel.StudentName,
                        FatherName       = viewModel.FatherName,
                        MotherName       = viewModel.MotherName,
                        DateOfBirth      = viewModel.DateOfBirth,
                        Email            = viewModel.StudentEmail,
                        PresentAddress   = viewModel.PresentAddress,
                        ParmanentAddress = viewModel.ParmanentAddress,
                        Religion         = viewModel.Religion,
                        Gender           = viewModel.Gender
                    };
                    if (StudentImage != null && StudentImage.ContentLength > 0)
                    {
                        using (var reader = new System.IO.BinaryReader(StudentImage.InputStream))
                        {
                            student.Image = reader.ReadBytes(StudentImage.ContentLength);
                        }
                    }
                    db.Student.Add(student);
                    db.SaveChanges();

                    int studentId = student.Id;
                    #endregion

                    #region Create Guardian
                    if (viewModel.GuardianName != null)
                    {
                        var guardian = new Guardian
                        {
                            Name           = viewModel.GuardianName,
                            Email          = viewModel.GuardianEmail,
                            Phone          = viewModel.GuardianPhone,
                            NID            = viewModel.NID,
                            GuardianTypeId = viewModel.GuardianTypeId,
                            StudentId      = studentId
                        };

                        db.Guardian.Add(guardian);
                        db.SaveChanges();
                    }

                    #endregion

                    #region Create Admission
                    if (viewModel.SessionId != 0)
                    {
                        var admission = new Admission
                        {
                            AdmissionDate       = viewModel.AdmissionDate,
                            SessionId           = viewModel.SessionId,
                            PreviousSchool      = viewModel.PreviousSchool,
                            PreviousSchoolAddrs = viewModel.PreviousSchoolAddrs,
                            StudentClassId      = viewModel.StudentClassId,
                            GroupId             = viewModel.GroupId,
                            StudentId           = studentId
                        };
                        if (Document != null && Document.ContentLength > 0)
                        {
                            using (var reader = new System.IO.BinaryReader(Document.InputStream))
                            {
                                admission.PreviousSchoolDocument = reader.ReadBytes(Document.ContentLength);
                            }
                        }

                        db.Admission.Add(admission);
                        db.SaveChanges();
                    }

                    #endregion

                    #region update Admission Account
                    if (viewModel.ClassFeeId != 0)
                    {
                        var amount      = db.ClassFee.Where(i => i.Id == viewModel.ClassFeeId).Select(a => a.AdmissionFee).FirstOrDefault();
                        var prevBalance = db.AccountList.Where(n => n.Name == "Admission").Select(c => c.CurrentBalance).FirstOrDefault();
                        var newBalance  = prevBalance + amount;
                        ap.UpdateAccountListBalance(1000, newBalance);
                    }

                    #endregion

                    dbTransaction.Commit();
                    return(RedirectToAction("Index", "Students"));
                }
                catch (Exception ex)
                {
                    #region catch
                    string abc = ex.Message + ex.InnerException;
                    dbTransaction.Rollback();

                    var studentClass = db.StudentClass.Select(c => new
                    {
                        Id   = c.Id,
                        Name = c.ClassName.Name + " || " + c.Shift.Name + " ||" + c.Section.Name
                    }).OrderBy(o => o.Name).ToList();
                    ViewBag.SessionId      = new SelectList(db.Session, "Id", "Name");
                    ViewBag.GuardianTypeId = new SelectList(db.GuardianType, "Id", "Name");
                    ViewBag.StudentClassId = new SelectList(studentClass, "Id", "Name");
                    ViewBag.GroupId        = new SelectList(db.Group, "Id", "Name");
                    return(RedirectToAction("Create"));

                    #endregion
                }
            }
        }
コード例 #4
0
 public Admission()
 {
     InitializeComponent();
     admissionVM = MainWindowViewModel.Instance.AdmissionVM;
 }
コード例 #5
0
        public bool SaveAdmissionRecording(AdmissionVM admissionVM)
        {
            UnitOfWork unitOfWork = new UnitOfWork();

            using (var dbTransaction = unitOfWork.dbContext.Database.BeginTransaction())
            {
                try
                {
                    Admission_Singapore singaporeAdmission;
                    bool isModify = false;
                    using (var db = new PERFECTIBSEntities())
                    {
                        singaporeAdmission = db.Admission_Singapore.Where(p => p.ReferenceNo.Equals(admissionVM.ReferenceNo.Trim())).FirstOrDefault();
                        if (singaporeAdmission != null)
                        {
                            isModify = true;
                        }
                    }

                    if (singaporeAdmission == null)
                    {
                        singaporeAdmission = new Admission_Singapore();
                    }

                    #region Assign Properties
                    singaporeAdmission.SingaporeAdmissionId = 0;
                    singaporeAdmission.ReferenceNo          = admissionVM.ReferenceNo == null ? "":admissionVM.ReferenceNo.Trim();
                    singaporeAdmission.PatientName          = admissionVM == null || admissionVM.DeductionID == null?"0": admissionVM.DeductionID.ToString();

                    singaporeAdmission.DateOfBirth = !string.IsNullOrEmpty(admissionVM.DateOfBirth) ? DateTime.ParseExact(admissionVM.DateOfBirth, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    // singaporeAdmission.DateOfBirth = DateTime.Parse(admissionVM.DateOfBirth);
                    singaporeAdmission.PassportNumber = admissionVM.PassportNumber.Trim();
                    singaporeAdmission.Scheme         = admissionVM == null?"": admissionVM.Scheme.Trim();


                    singaporeAdmission.InimatedDate         = !string.IsNullOrEmpty(admissionVM.InimatedDate) ? DateTime.ParseExact(admissionVM.InimatedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    singaporeAdmission.InceptionDate        = !string.IsNullOrEmpty(admissionVM.InceptionDate) ? DateTime.ParseExact(admissionVM.InceptionDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");;
                    singaporeAdmission.Deductible           = admissionVM == null?0: admissionVM.Deductible;
                    singaporeAdmission.DeductibleForTheYear = admissionVM == null?0: admissionVM.DeductibleUsedForTheYear;
                    singaporeAdmission.Exclusions           = admissionVM == null?0: admissionVM.Exclusions;
                    singaporeAdmission.Hospital             = admissionVM == null || admissionVM.Hospital == null? "": admissionVM.Hospital;
                    singaporeAdmission.AdmissionDate        = !string.IsNullOrEmpty(admissionVM.AdmissionDate) ? DateTime.ParseExact(admissionVM.AdmissionDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    singaporeAdmission.DischargeDate        = !string.IsNullOrEmpty(admissionVM.DischargedDate) ? DateTime.ParseExact(admissionVM.DischargedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");;
                    singaporeAdmission.CaseNumber           = admissionVM == null || admissionVM.CaseNumber == null ? "" : admissionVM.CaseNumber;;
                    singaporeAdmission.Illness                = admissionVM == null || admissionVM.Illness == null? "": admissionVM.Illness.Trim();
                    singaporeAdmission.ConsultantName         = admissionVM == null || admissionVM.ConsultantName == null ? "" : admissionVM.ConsultantName.Trim();
                    singaporeAdmission.InformedBy             = admissionVM == null || admissionVM.InformedBy == null? "" : admissionVM.InformedBy.Trim();
                    singaporeAdmission.GOPAmount              = admissionVM == null ? 0 : admissionVM.GOPAmount;
                    singaporeAdmission.ExtendedGOP            = admissionVM == null ? 0 : admissionVM.ExtendedGOP;
                    singaporeAdmission.FinalAmount            = admissionVM == null ? 0 : admissionVM.FinalAmount;
                    singaporeAdmission.ConsultantFee          = admissionVM == null ? 0 : admissionVM.ConsultantFee;
                    singaporeAdmission.FinalBillReceivedDate  = !string.IsNullOrEmpty(admissionVM.FinalBillRecievedDate) ? DateTime.ParseExact(admissionVM.FinalBillRecievedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    singaporeAdmission.PaymentGivenToAccount  = admissionVM == null ? 0 : admissionVM.PaymentGivenToAccount;
                    singaporeAdmission.ReferalFee             = admissionVM == null ? 0 : admissionVM.ReferalFee;
                    singaporeAdmission.FinalBill              = admissionVM == null ? 0 : admissionVM.FinalBillAmount;
                    singaporeAdmission.ReferalFeeReceivedDate = !string.IsNullOrEmpty(admissionVM.ReferalFeeReceivedDate) ? DateTime.ParseExact(admissionVM.ReferalFeeReceivedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    singaporeAdmission.PaymentGivenToAccount  = admissionVM == null ? 0 : admissionVM.PaymentGivenToAccount;
                    singaporeAdmission.ReferalFeeReceivedTTNo = admissionVM == null || admissionVM.ReferalFeeReceivedTtTransfer == null? "": admissionVM.ReferalFeeReceivedTtTransfer.ToString(); // WRONG DT
                    singaporeAdmission.Remark           = admissionVM == null || admissionVM.Remark == null ? "" : admissionVM.Remark.Trim();
                    singaporeAdmission.ExtendedGOPDate  = !string.IsNullOrEmpty(admissionVM.ExtendedGOPDate) ? DateTime.ParseExact(admissionVM.ExtendedGOPDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Parse("01/01/1900");
                    singaporeAdmission.CMAInvoiceNumber = admissionVM == null || admissionVM.CMAInvoiceNumber == null ? "" : admissionVM.CMAInvoiceNumber;
                    singaporeAdmission.MemberID         = 0;
                    singaporeAdmission.DependantID      = 0;
                    #endregion

                    if (!isModify)
                    {
                        unitOfWork.tblAdmission_Singapore.Insert(singaporeAdmission);
                    }
                    else
                    {
                        unitOfWork.tblAdmission_Singapore.Update(singaporeAdmission);
                    }

                    unitOfWork.Save();

                    dbTransaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    dbTransaction.Rollback();
                    return(false);
                }
            }
        }