public ActionResult DeleteConfirmed(int id)
        {
            tblAdmission tblAdmission = db.tblAdmissions.Find(id);

            db.tblAdmissions.Remove(tblAdmission);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "IDAdmission,IDResident,AdmissionDate,TerminationDate,TreatmentFee,IsActive,Notes,TotalBilling,TotalPaid,OverallBalance,StopTFBilling,Status,IDRank,Phase")] tblAdmission tblAdmission)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblAdmission).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblAdmission));
 }
        // GET: tblAdmissions/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblAdmission tblAdmission = db.tblAdmissions.Find(id);

            if (tblAdmission == null)
            {
                return(HttpNotFound());
            }
            return(View(tblAdmission));
        }
Beispiel #4
0
        public int InsertStudentSectionAllocation(int SessionId, int ClassId, int EnquiryId, int AdmissionId, int SectionId, bool isactive, string status)
        {
            int TotalStudent = 0;

            using (response = new Response())
            {
                using (dbcontext = new SchoolManagementEntities())
                {
                    try
                    {
                        response.success = true;
                        tblPromoteToClass obj = new tblPromoteToClass();
                        if (obj != null)
                        {
                            obj.AdmissionId = AdmissionId;
                            obj.SectionId   = SectionId;
                            obj.IsActive    = isactive;
                            obj.Status      = status;
                            dbcontext.tblPromoteToClasses.Add(obj);
                            dbcontext.SaveChanges();

                            tblEnquiryDetail obj1 = dbcontext.tblEnquiryDetails.Where(x => x.EnquiryId == EnquiryId).FirstOrDefault();
                            if (obj1 != null)
                            {
                                obj1.SectionId = SectionId;
                                dbcontext.SaveChanges();
                            }

                            tblAdmission obj2 = dbcontext.tblAdmissions.Where(x => x.AdmissionId == AdmissionId).FirstOrDefault();
                            if (obj2 != null)
                            {
                                obj2.InSectionStatus = status;
                                dbcontext.SaveChanges();
                            }
                        }

                        TotalStudent = 1;
                    }
                    catch (Exception ex)
                    {
                        response.success = false;
                        response.message = ex.Message;
                        TotalStudent     = 0;
                    }
                }
            }
            return(TotalStudent);
        }
        public ActionResult Create([Bind(Include = "RegID,RegNo,ApplicantName,ApplicantNameInUrdu,FatherNameInUrdu,AddressInUrdu,DateOfBirth,ImagePath,LOGO,StageID,ClassID,DarsgahID,SectionID,Age,BloodGroup,BFormNo,PhoneNo,MobileNo,TemporaryAddress,PermanentAddress,Gender,FatherName,FatherNIC,FatherMobileNo,FatherOccupation,FatherQualification,FatherMonthlySalary,FatherOfficeAddress,FatherOfficePhoneNo,MotherName,MotherNIC,MotherMobileNo,MotherOccupation,MotherQualification,MotherMonthlySalary,MotherOfficeAddress,MotherOfficePhoneNo,DeleteBy,DeleteDate,CreateBy,CreateDate,UpdateBy,UpdateDate,IsDelete,IsActive,IsAdmit,PostDate,portalutilities._schollid,SessionID,Remarks,ReligionID,AreaID,CityID,ProvinceID,CountryID,GardianName,LastClassAttended,LastSchoolAttended,NativeLang,RelationtoStu,NameofSignatory,IsSendMsgtoFather,IsSendMsgtoMother,PortalID,DateOfAdmission,DateOfRemoval,ClassAtTimeOfRemoval,CauseOfRemoval")] tblStudentRegMst tblstudentregmst)
        {
            //if (ModelState.IsValid)

            #region Registration
            tblstudentregmst.CreateDate = portalutilities._GetDate;
            tblstudentregmst.CreateBy   = portalutilities._username;
            tblstudentregmst.IsDelete   = false;
            tblstudentregmst.IsActive   = true;
            tblstudentregmst.SchoolID   = portalutilities._schollid;
            tblstudentregmst.IsDelete   = false;
            db.tblStudentRegMst.Add(tblstudentregmst);
            db.SaveChanges();
            #endregion

            #region Adminssion

            tblAdmission adm = new tblAdmission();
            adm.RegID      = tblstudentregmst.RegID;
            adm.Remarks    = tblstudentregmst.Remarks;
            adm.RollNo     = Convert.ToInt32(Request["RollNo"]);
            adm.GRNo       = (Request["GRNo"]).ToString();
            adm.BankID     = Convert.ToInt32(Request["BankID"]);
            adm.ChallanNo  = Convert.ToInt32(Request["ChallanNo"]);
            adm.DiscountID = Convert.ToInt32(Request["DiscountID"]);
            adm.Hostel     = Convert.ToBoolean(Request["Hostel"]);
            adm.PostDate   = tblstudentregmst.PostDate;
            adm.CreateDate = portalutilities._GetDate;
            adm.CreateBy   = portalutilities._username;
            adm.IsDelete   = false;
            adm.IsActive   = true;
            adm.SchoolID   = portalutilities._schollid;
            adm.IsDelete   = false;
            db.tblAdmission.Add(adm);
            db.SaveChanges();
            #endregion

            //
            return(RedirectToAction("Index"));


            return(View(tblstudentregmst));
        }
        public Response SaveEnquiryDetails(EnquiryDetailCustomModel objModel)
        {
            int NewEnquiryId   = 0;
            int NewAdmissionId = 0;

            using (response = new Response())
            {
                using (dbcontext = new SchoolManagementEntities())
                {
                    try
                    {
                        response.success = true;
                        if (objModel.EnquiryId == 0)
                        {
                            var rs = dbcontext.tblEnquiryDetails.FirstOrDefault(x => x.IsDeleted == false && x.EmailId == objModel.EmailId && x.MobileNo == objModel.MobileNo);
                            if (rs == null)
                            {
                                tblEnquiryDetail objAddNew = new tblEnquiryDetail
                                {
                                    SchoolId       = Convert.ToInt32(CommonHelper.TaskSchoolId.SchoolId),
                                    ClassId        = objModel.ClassId,
                                    SessionId      = objModel.SessionId,
                                    FName          = objModel.FName,
                                    LName          = objModel.LName,
                                    MobileNo       = objModel.MobileNo,
                                    EmailId        = objModel.EmailId,
                                    FatherName     = objModel.FatherName,
                                    MotherName     = objModel.MotherName,
                                    Village        = objModel.Village,
                                    City           = objModel.City,
                                    State          = objModel.State,
                                    PinCode        = objModel.PinCode,
                                    Address        = objModel.Address,
                                    Country        = "India",
                                    Gender         = objModel.Gender,
                                    BloodGroup     = objModel.BloodGroup,
                                    AadharNumber   = objModel.AadharNumber,
                                    Landline       = objModel.Landline,
                                    Qualification  = objModel.Qualification,
                                    DateOfBirth    = objModel.DateOfBirth,
                                    EnquiryDate    = objModel.EnquiryDate,
                                    CounsellorName = objModel.CounsellorName,
                                    Comments       = objModel.Comments,
                                    Status         = objModel.Status,
                                    HowToKnowUs    = objModel.HowToKnowUs,
                                    ReferredBy     = objModel.ReferredBy,

                                    IsActive     = true,
                                    IsDeleted    = false,
                                    CreatedBy    = objModel.CreatedBy,
                                    CreatedDate  = DateTime.Now,
                                    ModifiedBy   = objModel.ModifiedBy,
                                    ModifiedDate = DateTime.Now,
                                };

                                dbcontext.tblEnquiryDetails.Add(objAddNew);
                                dbcontext.SaveChanges();

                                if (objModel.Status == "Registered")
                                {
                                    tblAdmission objAddAdmission = new tblAdmission
                                    {
                                        EnquiryId        = objAddNew.EnquiryId,
                                        AdmissionDate    = objModel.AdmissionModel.AdmissionDate,
                                        TotalFees        = objModel.AdmissionModel.TotalFees,
                                        RegistrationFees = objModel.AdmissionModel.RegistrationFees,
                                        FeeToBePaid      = (Convert.ToDecimal(objModel.AdmissionModel.TotalFees) - Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount)),
                                        DiscountType     = objModel.AdmissionModel.DiscountType,
                                        DiscountAmount   = objModel.AdmissionModel.DiscountAmount,
                                        BalanceAmountDue = (Convert.ToInt32(objModel.AdmissionModel.TotalFees) - (Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount) + Convert.ToDecimal(objModel.AdmissionModel.RegistrationFees))),

                                        FeeIncharge      = objModel.AdmissionModel.FeeIncharge,
                                        PaymentMode      = objModel.AdmissionModel.PaymentMode,
                                        NoOfInstallments = objModel.AdmissionModel.NoOfInstallments,
                                        NextPaymentDate  = objModel.AdmissionModel.NextPaymentDate,
                                        EnquiryStatus    = objModel.Status,
                                        InSectionStatus  = objModel.Status,

                                        IsActive     = true,
                                        IsDeleted    = false,
                                        CreatedBy    = objModel.AdmissionModel.CreatedBy,
                                        CreatedDate  = DateTime.Now,
                                        ModifiedBy   = objModel.AdmissionModel.ModifiedBy,
                                        ModifiedDate = DateTime.Now,
                                    };

                                    dbcontext.tblAdmissions.Add(objAddAdmission);
                                    dbcontext.SaveChanges();

                                    tblFeeCollection objAddAdmissionFee = new tblFeeCollection
                                    {
                                        SchoolId    = Convert.ToInt32(CommonHelper.TaskSchoolId.SchoolId),
                                        AdmissionId = objAddAdmission.AdmissionId,
                                        AmountPaid  = objModel.AdmissionModel.RegistrationFees,
                                        FeeDate     = DateTime.Now,
                                        FeeInCharge = objModel.AdmissionModel.FeeIncharge,
                                        FeeMode     = objModel.AdmissionModel.PaymentMode,
                                        FeeType     = "Registration Fees",

                                        CreatedDate  = DateTime.Now,
                                        CreatedBy    = objModel.CreatedBy,
                                        ModifiedDate = DateTime.Now,
                                        ModifiedBy   = objModel.ModifiedBy,
                                        IsActive     = true,
                                        IsDeleted    = false,
                                    };

                                    dbcontext.tblFeeCollections.Add(objAddAdmissionFee);
                                    dbcontext.SaveChanges();
                                }

                                response.responseData = new { EnquiryId = objAddNew.EnquiryId, FName = objAddNew.FName };
                                response.message      = "Record Added Successfully!";
                            }
                            else
                            {
                                response.success = false;
                                response.message = "Record Already Exists!";
                            }
                        }
                        else
                        {
                            var rs = dbcontext.tblEnquiryDetails.FirstOrDefault(x => x.IsDeleted == false && x.EmailId == objModel.EmailId && x.EnquiryId != objModel.EnquiryId);
                            if (rs == null)
                            {
                                var objUpdate = dbcontext.tblEnquiryDetails.FirstOrDefault(m => m.EnquiryId == objModel.EnquiryId);
                                if (objUpdate != null)
                                {
                                    objUpdate.ClassId        = objModel.ClassId;
                                    objUpdate.SessionId      = objModel.SessionId;
                                    objUpdate.FName          = objModel.FName;
                                    objUpdate.LName          = objModel.LName;
                                    objUpdate.MobileNo       = objModel.MobileNo;
                                    objUpdate.EmailId        = objModel.EmailId;
                                    objUpdate.FatherName     = objModel.FatherName;
                                    objUpdate.MotherName     = objModel.MotherName;
                                    objUpdate.Village        = objModel.Village;
                                    objUpdate.City           = objModel.City;
                                    objUpdate.PinCode        = objModel.PinCode;
                                    objUpdate.Address        = objModel.Address;
                                    objUpdate.State          = objModel.State;
                                    objUpdate.Gender         = objModel.Gender;
                                    objUpdate.BloodGroup     = objModel.BloodGroup;
                                    objUpdate.AadharNumber   = objModel.AadharNumber;
                                    objUpdate.Landline       = objModel.Landline;
                                    objUpdate.Qualification  = objModel.Qualification;
                                    objUpdate.DateOfBirth    = objModel.DateOfBirth;
                                    objUpdate.EnquiryDate    = objModel.EnquiryDate;
                                    objUpdate.CounsellorName = objModel.CounsellorName;
                                    objUpdate.Comments       = objModel.Comments;
                                    objUpdate.Status         = objModel.Status;
                                    objUpdate.HowToKnowUs    = objModel.HowToKnowUs;
                                    objUpdate.ReferredBy     = objModel.ReferredBy;

                                    objUpdate.ModifiedBy   = objModel.ModifiedBy;
                                    objUpdate.ModifiedDate = DateTime.Now;
                                    dbcontext.SaveChanges();
                                    // return objExpense.ExpenseApprovalId
                                    NewEnquiryId          = objModel.EnquiryId;
                                    response.responseData = new { EnquiryId = objModel.EnquiryId, FName = objModel.FName };
                                    response.message      = "Record Updated Successfully!";
                                }

                                if (objModel.Status == "Registered")
                                {
                                    decimal?FeePaidAmount = dbcontext.tblFeeCollections.Where(x => x.AdmissionId == objModel.EnquiryId).Sum(x => x.AmountPaid);
                                    var     objUpdateAdm  = dbcontext.tblAdmissions.FirstOrDefault(m => m.EnquiryId == objModel.EnquiryId);
                                    if (objUpdateAdm != null)
                                    {
                                        objUpdateAdm.AdmissionDate    = objModel.AdmissionModel.AdmissionDate;
                                        objUpdateAdm.TotalFees        = objModel.AdmissionModel.TotalFees;
                                        objUpdateAdm.RegistrationFees = objModel.AdmissionModel.RegistrationFees;
                                        objUpdateAdm.FeeToBePaid      = (Convert.ToDecimal(objModel.AdmissionModel.TotalFees) - Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount));
                                        objUpdateAdm.DiscountType     = objModel.AdmissionModel.DiscountType;
                                        objUpdateAdm.DiscountAmount   = objModel.AdmissionModel.DiscountAmount;

                                        //objUpdateAdm.BalanceAmountDue = (Convert.ToInt32(objModel.AdmissionModel.TotalFees) - (Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount) + Convert.ToDecimal(objModel.AdmissionModel.RegistrationFees)));

                                        objUpdateAdm.BalanceAmountDue = (Convert.ToInt32(objModel.AdmissionModel.TotalFees) - (Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount) + Convert.ToDecimal(dbcontext.tblFeeCollections.Where(x => x.AdmissionId == objUpdateAdm.AdmissionId).Sum(x => x.AmountPaid))));

                                        objUpdateAdm.FeeIncharge      = objModel.AdmissionModel.FeeIncharge;
                                        objUpdateAdm.PaymentMode      = objModel.AdmissionModel.PaymentMode;
                                        objUpdateAdm.NoOfInstallments = objModel.AdmissionModel.NoOfInstallments;
                                        objUpdateAdm.NextPaymentDate  = objModel.AdmissionModel.NextPaymentDate;
                                        objUpdateAdm.EnquiryStatus    = objModel.Status;
                                        objUpdateAdm.InSectionStatus  = objModel.Status;

                                        objUpdateAdm.ModifiedBy   = objModel.AdmissionModel.ModifiedBy;
                                        objUpdateAdm.ModifiedDate = DateTime.Now;

                                        dbcontext.SaveChanges();
                                        NewAdmissionId = objUpdateAdm.AdmissionId;

                                        //response.responseData = new { EnquiryId = objUpdate.EnquiryId, FName = objUpdate.FName };
                                        //response.message = "Record Updated Successfully!";
                                    }
                                    else
                                    {
                                        tblAdmission objAddAdmission = new tblAdmission
                                        {
                                            EnquiryId        = NewEnquiryId,
                                            AdmissionDate    = objModel.AdmissionModel.AdmissionDate,
                                            TotalFees        = objModel.AdmissionModel.TotalFees,
                                            RegistrationFees = objModel.AdmissionModel.RegistrationFees,
                                            FeeToBePaid      = (Convert.ToDecimal(objModel.AdmissionModel.TotalFees) - Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount)),
                                            DiscountType     = objModel.AdmissionModel.DiscountType,
                                            DiscountAmount   = objModel.AdmissionModel.DiscountAmount,
                                            BalanceAmountDue = (Convert.ToInt32(objModel.AdmissionModel.TotalFees) - (Convert.ToDecimal(objModel.AdmissionModel.DiscountAmount) + Convert.ToDecimal(objModel.AdmissionModel.RegistrationFees))),

                                            FeeIncharge      = objModel.AdmissionModel.FeeIncharge,
                                            PaymentMode      = objModel.AdmissionModel.PaymentMode,
                                            NoOfInstallments = objModel.AdmissionModel.NoOfInstallments,
                                            NextPaymentDate  = objModel.AdmissionModel.NextPaymentDate,
                                            EnquiryStatus    = objModel.Status,
                                            InSectionStatus  = objModel.Status,

                                            IsActive     = true,
                                            IsDeleted    = false,
                                            CreatedBy    = objModel.AdmissionModel.CreatedBy,
                                            CreatedDate  = DateTime.Now,
                                            ModifiedBy   = objModel.AdmissionModel.ModifiedBy,
                                            ModifiedDate = DateTime.Now,
                                        };

                                        dbcontext.tblAdmissions.Add(objAddAdmission);
                                        dbcontext.SaveChanges();
                                        NewAdmissionId = objAddAdmission.AdmissionId;
                                    }

                                    var objUpdateAdmFee = dbcontext.tblFeeCollections.FirstOrDefault(m => m.AdmissionId == NewAdmissionId);
                                    if (objUpdateAdmFee != null)
                                    {
                                        objUpdateAdmFee.AdmissionId = NewAdmissionId;
                                        objUpdateAdmFee.AmountPaid  = objModel.AdmissionModel.RegistrationFees;
                                        //objUpdateAdmFee.paymentmode
                                        objUpdateAdmFee.FeeDate     = DateTime.Now;
                                        objUpdateAdmFee.FeeInCharge = objModel.AdmissionModel.FeeIncharge;
                                        objUpdateAdmFee.FeeMode     = objModel.AdmissionModel.PaymentMode;
                                        objUpdateAdmFee.FeeType     = "Registration Fees";

                                        objUpdateAdmFee.CreatedDate  = DateTime.Now;
                                        objUpdateAdmFee.CreatedBy    = objModel.CreatedBy;
                                        objUpdateAdmFee.ModifiedDate = DateTime.Now;
                                        objUpdateAdmFee.ModifiedBy   = objModel.ModifiedBy;
                                        objUpdateAdmFee.IsActive     = true;
                                        objUpdateAdmFee.IsDeleted    = false;

                                        dbcontext.SaveChanges();
                                    }
                                    else
                                    {
                                        tblFeeCollection objAddAdmissionFee = new tblFeeCollection
                                        {
                                            SchoolId    = Convert.ToInt32(CommonHelper.TaskSchoolId.SchoolId),
                                            AdmissionId = NewAdmissionId,
                                            AmountPaid  = objModel.AdmissionModel.RegistrationFees,
                                            FeeDate     = DateTime.Now,
                                            FeeInCharge = objModel.AdmissionModel.FeeIncharge,
                                            FeeMode     = objModel.AdmissionModel.PaymentMode,
                                            FeeType     = "Registration Fees",

                                            CreatedDate  = DateTime.Now,
                                            CreatedBy    = objModel.CreatedBy,
                                            ModifiedDate = DateTime.Now,
                                            ModifiedBy   = objModel.ModifiedBy,
                                            IsActive     = true,
                                            IsDeleted    = false,
                                        };

                                        dbcontext.tblFeeCollections.Add(objAddAdmissionFee);
                                        dbcontext.SaveChanges();
                                    }
                                }
                            }
                            else
                            {
                                response.success = false;
                                response.message = "Record Already Exists!";
                            }
                        }
                        return(response);
                    }
                    catch (Exception ex)
                    {
                        response.success = false;
                        response.message = ex.Message;
                        return(response);
                    }
                }
            }
        }