public Response UpdateStudentRollNoAllocation(PromoteToClassCustomModel objModel) { using (objDAL = new RollNoAllocationRepo()) { return(objDAL.UpdateStudentRollNoAllocation(objModel)); } }
public Response SavePromoteToClassDetails(PromoteToClassCustomModel objModel) { using (objDAL = new PromoteToClassRepo()) { return(objDAL.SavePromoteToClassDetails(objModel)); } }
public ActionResult UpdateAllocationList(string[] Parameters, int SessionId, int ClassId, int SectionId, int LastClassId) { string ResultMessage = ""; try { int TotalStudent = 0; objBDC = new PromoteToClassBusiness(); PromoteToClassCustomModel objModel = new PromoteToClassCustomModel(); //TotalStudent = objBDC.GetTotalStudentInSection(SessionId, ClassId, SectionId); //if (TotalStudent > 30) //{ // ResultMessage = "Only 70 students are allowed in one batch."; //} if (Parameters != null) { int AfterStudentCount = TotalStudent + Parameters.Length; if (AfterStudentCount > 30) { ResultMessage = "Only 30 students are allowed in one section. You have selected " + Parameters.Length + " students. There are already " + TotalStudent + " students in this section."; } else { foreach (string Id in Parameters) { objModel.SessionId = SessionId; objModel.ClassId = ClassId; objModel.SectionId = SectionId; objModel.LastClassId = LastClassId; objModel.AdmissionId = Convert.ToInt32(Id); objModel.IsActive = true; objModel.Status = "Attending"; objBDC.SavePromoteToClassDetails(objModel); } ResultMessage = "Student Promoted to new class Successfully."; } } } catch (Exception ex) { } return(View(ResultMessage)); }
public ActionResult UpdateAllocationList(string[] Parameters, string[] ParametersValue) { string ResultMessage = ""; try { int TotalStudent = 0; objBDC = new RollNoAllocationBusiness(); PromoteToClassCustomModel objModel = new PromoteToClassCustomModel(); foreach (var nw in Parameters.Zip(ParametersValue, Tuple.Create)) { //Console.WriteLine(nw.Item1 + nw.Item2); objModel.PromoteToClassId = Convert.ToInt32(nw.Item1); objModel.RollNo = Convert.ToString(nw.Item2); objBDC.UpdateStudentRollNoAllocation(objModel); } //foreach (string Id in Parameters) //{ // objModel.SessionId = SessionId; // objModel.ClassId = ClassId; // objModel.SectionId = SectionId; // objModel.AdmissionId = Convert.ToInt32(Id); // objModel.IsActive = true; // objModel.Status = "Attending"; // objBDC.SaveSectionAllocationDetails(objModel); //} ResultMessage = "Student Allocated in batch Successfully."; } catch (Exception ex) { } return(View(ResultMessage)); }
public Response UpdateStudentRollNoAllocation(PromoteToClassCustomModel objModel) { using (response = new Response()) { using (dbcontext = new SchoolManagementEntities()) { try { response.success = true; var rs = dbcontext.tblPromoteToClasses.FirstOrDefault(x => x.IsDeleted == false && x.IsActive == true && x.PromoteToClassId == objModel.PromoteToClassId); if (rs != null) { rs.RollNo = objModel.RollNo; rs.ModifiedBy = objModel.ModifiedBy; rs.ModifiedDate = DateTime.Now; dbcontext.SaveChanges(); response.responseData = new { PromoteToClassId = objModel.PromoteToClassId }; response.message = "Record Added Successfully!"; } else { response.message = "Record Not Exists!"; } return(response); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }
public Response SavePromoteToClassDetails(PromoteToClassCustomModel objModel) { using (response = new Response()) { using (dbcontext = new SchoolManagementEntities()) { try { response.success = true; if (objModel.PromoteToClassId == 0) { var rs = dbcontext.tblPromoteToClasses.FirstOrDefault(x => x.IsDeleted == false && x.SessionId == objModel.SessionId && x.ClassId == objModel.ClassId && x.SectionId == objModel.SectionId && x.AdmissionId == objModel.AdmissionId); if (rs == null) { var AdmId = dbcontext.tblPromoteToClasses.Where(x => x.IsDeleted == false && x.IsActive == true && x.AdmissionId == objModel.AdmissionId); if (AdmId != null) { foreach (var item in AdmId) { item.IsActive = false; } dbcontext.SaveChanges(); } tblPromoteToClass objAddNew = new tblPromoteToClass { SessionId = objModel.SessionId, ClassId = objModel.ClassId, SectionId = objModel.SectionId, LastClassId = objModel.LastClassId, AdmissionId = objModel.AdmissionId, Status = "Attending", RecordStatus = "Promote To New Class", IsActive = true, IsDeleted = false, CreatedBy = objModel.CreatedBy, CreatedDate = DateTime.Now, ModifiedBy = objModel.ModifiedBy, ModifiedDate = DateTime.Now }; dbcontext.tblPromoteToClasses.Add(objAddNew); dbcontext.SaveChanges(); response.responseData = new { PromoteToClassId = objAddNew.PromoteToClassId, Status = objAddNew.Status }; response.message = "Record Added Successfully!"; } //else //{ // rs.SectionId = objModel.SectionId; // rs.Status = objModel.Status; // rs.IsActive = true; // rs.ModifiedBy = objModel.ModifiedBy; // rs.ModifiedDate = DateTime.Now; // dbcontext.SaveChanges(); // response.responseData = new { PromoteToClassId = rs.PromoteToClassId, Status = rs.Status }; // response.message = "Record Updated Successfully!"; //} } //else //{ // var rs = dbcontext.tblPromoteToClasses.FirstOrDefault(x => x.IsDeleted == false && x.SessionId == objModel.SessionId && x.ClassId == objModel.ClassId && x.AdmissionId == objModel.AdmissionId && x.PromoteToClassId != objModel.PromoteToClassId); // if (rs == null) // { // var objUpdate = dbcontext.tblPromoteToClasses.FirstOrDefault(m => m.PromoteToClassId == objModel.PromoteToClassId); // if (objUpdate != null) // { // objUpdate.SessionId = objModel.SessionId; // objUpdate.EnquiryId = objModel.EnquiryId; // objUpdate.AdmissionId = objModel.AdmissionId; // objUpdate.ClassId = objModel.ClassId; // objUpdate.SectionId = objModel.SectionId; // objUpdate.ModifiedBy = objModel.ModifiedBy; // objUpdate.ModifiedDate = DateTime.Now; // dbcontext.SaveChanges(); // response.responseData = new { PromoteToClassId = objUpdate.PromoteToClassId, Status = objUpdate.Status }; // response.message = "Record Updated Successfully!"; // } // } // else // { // response.success = false; // response.message = "Record Already Exists!"; // } //} return(response); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }