public ActionResult DeleteTourism(int id) { try { WebFunction web = new WebFunction(); tbl_TourismMaster abc = _tourim.Get(id); List <tbl_MultipleFileUpload> file = _mfile.GetAll().Where(x => x.SubMaster_fkid == abc.pkid).ToList(); foreach (var item in file) { web.DeleteImage(item.filepath); _mfile.Remove(item, true); } _tourim.Remove(id, true); return(Json("success", JsonRequestBehavior.AllowGet)); } catch { return(Json("failed", JsonRequestBehavior.AllowGet)); } }
public ActionResult REFMaster(tbl_REF_Arrival_DataMasterss model, HttpPostedFileBase MED, HttpPostedFileBase RIS, HttpPostedFileBase SERCER, HttpPostedFileBase SIG) { try { if (model.pkid == 0) { tbl_REF_Arrival_DataMaster abc = new tbl_REF_Arrival_DataMaster(); if (MED != null) { abc.MedicalCertificate = web.Storefile(MED, 3); } if (RIS != null) { abc.RiskCertificate = web.Storefile(RIS, 3); } abc.pkid = model.pkid; abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.Session_fkid = model.Session_fkid; abc.Student_fkid = model.Student_fkid; abc.ChestNo = model.ChestNo; abc.NCCNo = model.NCCNo; abc.Rank = model.Rank; abc.NCCunit = model.NCCunit; abc.GPHQ = model.GPHQ; abc.DTE = model.DTE; abc.MoveOrder = model.MoveOrder; abc.NominalRoll = model.NominalRoll; abc.IdentemnityBond = model.IdentemnityBond; abc.DetailsService = model.DetailsService; abc.AddedDate = DateTime.Now; abc.LastModifiedDate = DateTime.Now; if (SERCER != null) { abc.MedicalCertificate = web.Storefile(MED, 3); } if (SIG != null) { abc.SignOfIndivisual = web.Storefile(SIG, 3); } _REFMaster.Add(abc); } else { tbl_REF_Arrival_DataMaster abc = _REFMaster.Get(model.pkid); if (MED != null) { if (model.MedicalCertificate != null) { web.DeleteImage(model.MedicalCertificate); } abc.MedicalCertificate = web.Storefile(MED, 3); } if (RIS != null) { if (model.RiskCertificate != null) { web.DeleteImage(model.RiskCertificate); } abc.RiskCertificate = web.Storefile(RIS, 3); } if (SERCER != null) { if (model.Copyofpreviouscertific != null) { web.DeleteImage(model.Copyofpreviouscertific); } abc.Copyofpreviouscertific = web.Storefile(SERCER, 3); } if (SIG != null) { if (model.SignOfIndivisual != null) { web.DeleteImage(model.SignOfIndivisual); } abc.SignOfIndivisual = web.Storefile(SIG, 3); } abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.Session_fkid = model.Session_fkid; abc.Student_fkid = model.Student_fkid; abc.ChestNo = model.ChestNo; abc.NCCNo = model.NCCNo; abc.Rank = model.Rank; abc.NCCunit = model.NCCunit; abc.GPHQ = model.GPHQ; abc.DTE = model.DTE; abc.MoveOrder = model.MoveOrder; abc.NominalRoll = model.NominalRoll; abc.IdentemnityBond = model.IdentemnityBond; abc.DetailsService = model.DetailsService; abc.AddedDate = model.AddedDate; abc.LastModifiedDate = DateTime.Now; _REFMaster.Update(abc); } return(RedirectToAction("REFMaster", "ArrivalSchema")); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); return(RedirectToAction("REFMaster", "ArrivalSchema")); } }
public ActionResult AddStudent(tbl_StudentMasterss model, HttpPostedFileBase Mcopy, HttpPostedFileBase BIODATA, HttpPostedFileBase Medicalcer) { WebFunction web = new WebFunction(); string exception = ""; try { if (model.pkid == 0) { tbl_StudentMaster abc = new tbl_StudentMaster(); if (Mcopy != null) { abc.Movement_copy = web.Storefile(Mcopy, 2); } if (BIODATA != null) { abc.BIODataForm = web.Storefile(BIODATA, 2); } if (Medicalcer != null) { abc.MedicalCertificate = web.Storefile(Medicalcer, 2); } abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.UserName = model.UserName; abc.Password = model.Password; abc.ConfirmedPassword = model.ConfirmedPassword; abc.CommisionNo = model.CommisionNo; abc.DateComm = model.DateComm; abc.Rank = model.Rank; abc.FullName = model.FullName; abc.DateOfBirth = model.DateOfBirth; abc.PlaceOfBirth = model.PlaceOfBirth; abc.IdentificationMarks = model.IdentificationMarks; abc.Height = model.Height; abc.Weight = model.Weight; abc.ColorOfEye = model.ColorOfEye; abc.ColorOfHair = model.ColorOfHair; abc.Religion = model.Religion; abc.Caste = model.Caste; abc.Nationality = model.Nationality; abc.UnitAndLocation = model.UnitAndLocation; abc.HQGroup = model.HQGroup; abc.Directorate = model.Directorate; abc.State = model.State; abc.CourseSeries = model.CourseSeries; abc.ChestNo = model.ChestNo; abc.DUCFrom = model.DUCFrom; abc.DUCTo = model.DUCTo; abc.ArrivalInNCCOTA = model.ArrivalInNCCOTA; abc.MotherToughe = model.MotherToughe; abc.PresentAddress = model.PresentAddress; abc.ParmanentAddress = model.ParmanentAddress; abc.MaritalStatus = model.MaritalStatus; abc.NOKFullName = model.NOKFullName; abc.NOKAddress = model.NOKAddress; abc.NOKRelation = model.NOKRelation; abc.TeachingInstitideName = model.TeachingInstitideName; abc.TeachingSubject = model.TeachingSubject; abc.TeachingDateOfEmplyment = model.TeachingDateOfEmplyment; abc.TeachingEmpStatus = model.TeachingEmpStatus; abc.NCCorOTUMember = model.NCCorOTUMember; abc.WhichDivision = model.WhichDivision; abc.WhichForce = model.WhichForce; abc.TrainingPeriod = model.TrainingPeriod; abc.RankofNCC = model.RankofNCC; abc.MedicallyExamined = model.MedicallyExamined; abc.AlimentName = model.AlimentName; abc.MovementOrderNo = model.MovementOrderNo; abc.MovementDate = model.MovementDate; abc.Games = model.Games; abc.OtherQualification = model.OtherQualification; abc.ReadNCCActRules = model.ReadNCCActRules; abc.ReadNCCorDG = model.ReadNCCorDG; abc.ReadSyllabus = model.ReadSyllabus; abc.ReadHandbook = model.ReadHandbook; abc.ReadNCCCompPlanning = model.ReadNCCCompPlanning; abc.ReadNCCCompInstruction = model.ReadNCCCompInstruction; abc.DateOfPreCourseTraining = model.DateOfPreCourseTraining; abc.Place = model.Place; abc.AddedDate = DateTime.Now; _student.Add(abc); exception = "Save Successfully"; } else { int _id = Convert.ToInt32(model.pkid); tbl_StudentMaster abc = _student.Get(_id); if (Mcopy != null) { if (model.Movement_copy != null) { web.DeleteImage(model.Movement_copy); } abc.Movement_copy = web.Storefile(Mcopy, 2); } if (BIODATA != null) { if (model.BIODataForm != null) { web.DeleteImage(model.BIODataForm); } abc.BIODataForm = web.Storefile(BIODATA, 2); } if (Medicalcer != null) { if (model.MedicalCertificate != null) { web.DeleteImage(model.MedicalCertificate); } abc.MedicalCertificate = web.Storefile(Medicalcer, 2); } abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.UserName = model.UserName; abc.Password = model.Password; abc.ConfirmedPassword = model.ConfirmedPassword; abc.CommisionNo = model.CommisionNo; abc.DateComm = model.DateComm; abc.Rank = model.Rank; abc.FullName = model.FullName; abc.DateOfBirth = model.DateOfBirth; abc.PlaceOfBirth = model.PlaceOfBirth; abc.IdentificationMarks = model.IdentificationMarks; abc.Height = model.Height; abc.Weight = model.Weight; abc.ColorOfEye = model.ColorOfEye; abc.ColorOfHair = model.ColorOfHair; abc.Religion = model.Religion; abc.Caste = model.Caste; abc.Nationality = model.Nationality; abc.UnitAndLocation = model.UnitAndLocation; abc.HQGroup = model.HQGroup; abc.Directorate = model.Directorate; abc.State = model.State; abc.CourseSeries = model.CourseSeries; abc.ChestNo = model.ChestNo; abc.DUCFrom = model.DUCFrom; abc.DUCTo = model.DUCTo; abc.ArrivalInNCCOTA = model.ArrivalInNCCOTA; abc.MotherToughe = model.MotherToughe; abc.PresentAddress = model.PresentAddress; abc.ParmanentAddress = model.ParmanentAddress; abc.MaritalStatus = model.MaritalStatus; abc.NOKFullName = model.NOKFullName; abc.NOKAddress = model.NOKAddress; abc.NOKRelation = model.NOKRelation; abc.TeachingInstitideName = model.TeachingInstitideName; abc.TeachingSubject = model.TeachingSubject; abc.TeachingDateOfEmplyment = model.TeachingDateOfEmplyment; abc.TeachingEmpStatus = model.TeachingEmpStatus; abc.NCCorOTUMember = model.NCCorOTUMember; abc.WhichDivision = model.WhichDivision; abc.WhichForce = model.WhichForce; abc.TrainingPeriod = model.TrainingPeriod; abc.RankofNCC = model.RankofNCC; abc.MedicallyExamined = model.MedicallyExamined; abc.AlimentName = model.AlimentName; abc.MovementOrderNo = model.MovementOrderNo; abc.MovementDate = model.MovementDate; abc.Games = model.Games; abc.OtherQualification = model.OtherQualification; abc.ReadNCCActRules = model.ReadNCCActRules; abc.ReadNCCorDG = model.ReadNCCorDG; abc.ReadSyllabus = model.ReadSyllabus; abc.ReadHandbook = model.ReadHandbook; abc.ReadNCCCompPlanning = model.ReadNCCCompPlanning; abc.ReadNCCCompInstruction = model.ReadNCCCompInstruction; abc.DateOfPreCourseTraining = model.DateOfPreCourseTraining; abc.Place = model.Place; abc.AddedDate = DateTime.Now; _student.Update(abc); exception = "Updated Successfully"; } return(RedirectToAction("StudentMaster", "Student", new { Exception = exception })); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); exception = e.Message; return(RedirectToAction("StudentMaster", "Student", new { Exception = exception })); } }