public ActionResult Create([Bind(Prefix = "Item1", Include = "ProjectProfileID,FunctionID,ProgramID,AccountCodeID,OfficialCodeID,LineNumber,SectorID,ProjectTitle,ProjectDescription,ImpDeptID,ProjStartDate,ProjEndDate,ProjStatusID,ProjExpectedOutput,SourceFundID,BDIPID,ProjCatID,ProjReferenceOutput,ProjItemWork,MunicipalityID,barangayID,ProjPurok,Remarks,ProjPS,ProjMOOE,ProjCapitalOutlay,StrategicPriorityID,StrategicPriorityAreaID,MitigationTypologyID,AdaptationTypologyID")] ProjectProfile ProjectProfile) { try { var check2 = ProjectProfile.ProjectTitle; var IsExisting = db.ProjectProfiles.FirstOrDefault(user => user.ProjectTitle == check2); if (IsExisting == null) { if (ModelState.IsValid) { db.ProjectProfiles.Add(ProjectProfile); db.SaveChanges(); return(RedirectToAction("Create")); } } else { return(View(ProjectProfile)); } } catch { ModelState.AddModelError("", "Project already exists."); } return(View(ProjectProfile)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "appuserid,empid,username,password,roles")] appUser appUser) { ModelState.Clear(); UserDD(); var check = appUser.empid; var HasAccount = db.appUsers.Where(user => user.empid == check).Select(user => user.empid).FirstOrDefault().ToString(); var check2 = appUser.username; var IsExisting = db.appUsers.FirstOrDefault(user => user.username == check2); if (HasAccount == "") { if (IsExisting == null) { if (ModelState.IsValid) { db.appUsers.Add(appUser); db.SaveChanges(); return(RedirectToAction("Create")); } } else if (IsExisting != null) { ModelState.AddModelError("", "User name is already taken."); } } else if (HasAccount != "") { ModelState.AddModelError("", "Employee already has an account."); } return(View(appUser)); }
public ActionResult Create([Bind(Include = "empLeaveAppID,empID,LeaveTypeID,LeaveReason,DateFiled,StartDate,EndDate,AppliedHours,ApprovedDate,ApprovedBy,IsApproved,IsWithPay,IsCancelled,Remarks,StampTime")] EmpLeaveApplication empLeaveApplication, string Create, string Edit) { EmployeeDD(); LeaveTypeDD(); SupervisorDD(); var check = empLeaveApplication.empLeaveAppID; var CheckAttendance = db.EmpLeaveApplications.FirstOrDefault(id => id.empLeaveAppID == empLeaveApplication.empLeaveAppID); if (ModelState.IsValid) { if (Create != null) { if (CheckAttendance == null) { string conn = ConfigurationManager.ConnectionStrings["kalingaPPDO"].ConnectionString; using (SqlConnection cn = new SqlConnection(conn)) { SqlCommand cmd = cn.CreateCommand(); cmd.CommandText = "Execute sp_InsertEmpLeave @empID, @empAttendanceMainID, @LeaveTypeID, @LeaveReason, @DateFiled, @StartDate, @EndDate, @AppliedHours, @ApprovedDate, @ApprovedBy, @IsApproved, @IsWithPay, @IsCancelled, @Remarks"; cmd.Parameters.AddWithValue("@empID", empLeaveApplication.empID); cmd.Parameters.AddWithValue("@empAttendanceMainID", empLeaveApplication.empAttendanceMainID.ToString()); cmd.Parameters.AddWithValue("@@attendancedetaildtrID", empLeaveApplication.AttendanceDetailDTRId.ToString()); cmd.Parameters.AddWithValue("@LeaveTypeID", empLeaveApplication.LeaveTypeID); cmd.Parameters.AddWithValue("@LeaveReason", empLeaveApplication.LeaveReason); cmd.Parameters.AddWithValue("@DateFiled", empLeaveApplication.DateFiled); cmd.Parameters.AddWithValue("@StartDate", empLeaveApplication.StartDate); cmd.Parameters.AddWithValue("@EndDate", empLeaveApplication.EndDate); cmd.Parameters.AddWithValue("@AppliedHours", empLeaveApplication.AppliedHours); cmd.Parameters.AddWithValue("@ApprovedDate", empLeaveApplication.ApprovedDate); cmd.Parameters.AddWithValue("@ApprovedBy", empLeaveApplication.ApprovedBy); cmd.Parameters.AddWithValue("@IsApproved", empLeaveApplication.IsApproved); cmd.Parameters.AddWithValue("@IsWithPay", empLeaveApplication.IsWithPay); cmd.Parameters.AddWithValue("@IsCancelled", empLeaveApplication.IsCancelled); cmd.Parameters.AddWithValue("@Remarks", empLeaveApplication.Remarks); cn.Open(); cmd.ExecuteNonQuery(); cn.Close(); return(RedirectToAction("Create")); } } else { ModelState.AddModelError(string.Empty, "Leave Number " + empLeaveApplication.empLeaveAppID + " already exists. Please click update if you're trying to update a data."); return(View(empLeaveApplication)); } } else if (Edit != null) { db.Set <EmpLeaveApplication>().AddOrUpdate(empLeaveApplication); db.SaveChanges(); return(RedirectToAction("Create")); } } return(View(empLeaveApplication)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "empEducID,empID,EducLevelID,SchoolName,DegreeID,YearGraduated,Earned,StartDate,EndDate,Distinction")] EmpEducationHistory empEducationHistory) { if (ModelState.IsValid) { db.EmpEducationHistories.Add(empEducationHistory); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(empEducationHistory)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "empCertID,empID,ExamName,Rating,ExamDate,ExamVenue,LicenseNumber,ReleaseDate")] EmpCertificate empCertificate) { if (ModelState.IsValid) { db.EmpCertificates.Add(empCertificate); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(empCertificate)); }
public ActionResult Edit([Bind(Include = "ProjectProfileID,FunctionID,ProgramID,AccountCodeID,OfficialCodeID,LineNumber,SectorID,ProjectTitle,ProjectDescription,ImpDeptID,ProjStartDate,ProjEndDate,ProjStatusID,ProjExpectedOutput,SourceFundID,BDIPID,ProjCatID,ProjReferenceOutput,ProjItemWork,MunicipalityID,barangayID,ProjPurok,Remarks,ProjPS,ProjMOOE,ProjCapitalOutlay,StrategicPriorityID,StrategicPriorityAreaID,MitigationTypologyID,AdaptationTypologyID")] ProjectProfile projectProfile) { if (ModelState.IsValid) { db.Entry(projectProfile).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(projectProfile); }
public ActionResult Create([Bind(Include = "EthnicityID,EthnicityDesc")] ref_Ethnicity ref_Ethnicity) { if (ModelState.IsValid) { db.ref_Ethnicity.Add(ref_Ethnicity); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Ethnicity)); }
public ActionResult Create([Bind(Include = "AttendanceDetailDTRId,empAttendanceMainID,NameDate,DTRDate,empID,LOGIN,LOGOUT,AbsHrs,AbsHrsDec,LateHrs,LateHrsDec,UnderTimeHours,UnderTimeHoursDec")] rep_AbsencesTardinessDetailsPerEmployee rep_AbsencesTardinessDetailsPerEmployee) { if (ModelState.IsValid) { db.rep_AbsencesTardinessDetailsPerEmployee.Add(rep_AbsencesTardinessDetailsPerEmployee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rep_AbsencesTardinessDetailsPerEmployee)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "TypologyID,StrategicPriorityID,StrategicPriorityAreaID,StratPriorityClassID,StrategicPriorityGrpID,TypologyCode,TypologyDescription")] ref_ClimateChangeTypology ref_ClimateChangeTypology) { if (ModelState.IsValid) { db.ref_ClimateChangeTypology.Add(ref_ClimateChangeTypology); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_ClimateChangeTypology)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "PopGrowthRateID,MunicipalityID,GrowthRate,YearTaken")] PopulationGrowthRate populationGrowthRate) { if (ModelState.IsValid) { db.PopulationGrowthRates.Add(populationGrowthRate); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(populationGrowthRate)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "empVolID,empID,OrganizationName,OrganizationAddress,StartDate,EndDate,HoursVolunteered,InvolveTypeID,OrganizationNature")] EmpVolunteer empVolunteer) { if (ModelState.IsValid) { db.EmpVolunteers.Add(empVolunteer); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(empVolunteer)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "HolidayID,HolidayDescription,HolidayDate,DayTypeID,NoOfHours")] ref_Holiday ref_Holiday) { if (ModelState.IsValid) { db.ref_Holiday.Add(ref_Holiday); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Holiday)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "PositionID,PositionDescription")] ref_Position ref_Position) { if (ModelState.IsValid) { db.ref_Position.Add(ref_Position); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Position)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "provinceID,CountryID,RegionID,ProvinceDistrict,Capital")] ref_Province ref_Province) { if (ModelState.IsValid) { db.ref_Province.Add(ref_Province); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Province)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "PopDistributionID,MunicipalityID,Population,YearTaken")] PopulationDistribution populationDistribution) { if (ModelState.IsValid) { db.PopulationDistributions.Add(populationDistribution); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(populationDistribution)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "CornProdID,MunicipalityID,CornID,AreaHectares,Production,ProdYield,YearTaken")] CornProduction cornProduction) { if (ModelState.IsValid) { db.CornProductions.Add(cornProduction); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(cornProduction)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "BDIPID,MunicipalityID,BDIPMunicipalityCode,BDIPMunicipality")] ref_BDIPperMunicipality ref_BDIPperMunicipality) { if (ModelState.IsValid) { db.ref_BDIPperMunicipality.Add(ref_BDIPperMunicipality); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_BDIPperMunicipality)); }
public ActionResult Create([Bind(Include = "empLeaveAppID,empID,Fullname,LeaveTypeDescription,DateFiled,StartDate,EndDate,AppliedHours,IsApproved,IsCancelled,Supervisor,DateAction,empAttendanceMainID,LeaveReason")] Rep_EmpLeaveApplication rep_EmpLeaveApplication) { if (ModelState.IsValid) { db.Rep_EmpLeaveApplication.Add(rep_EmpLeaveApplication); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rep_EmpLeaveApplication)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "ProjStatusID,ProjStatusCode,ProjStatusDescription")] ref_ProjectStatus ref_ProjectStatus) { if (ModelState.IsValid) { db.ref_ProjectStatus.Add(ref_ProjectStatus); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_ProjectStatus)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "PopMigrationID,MunicipalityID,MigratingIN,MigratingINPer,MigratingOUT,MigratingOUTPer,YearTaken")] PopulationMigrationRate populationMigrationRate) { if (ModelState.IsValid) { db.PopulationMigrationRates.Add(populationMigrationRate); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(populationMigrationRate)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "workID,empID,Company,StartDate,EndDate,PositionID,MonthlySalary,SalaryGradeID,SGIncrementID,AppointmentStatusID,IsGovService,IsSupervisor")] EmpWorkHistory empWorkHistory) { if (ModelState.IsValid) { db.EmpWorkHistories.Add(empWorkHistory); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(empWorkHistory)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "WorkersMajorOccupationID,MajorOccupationID,AgeGroupID,GenderID,NumberofPopulation,YearTaken")] WorkersByMajorOCcupation workersByMajorOCcupation) { if (ModelState.IsValid) { db.WorkersByMajorOCcupations.Add(workersByMajorOCcupation); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(workersByMajorOCcupation)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "DeptID,DeptCode,DeptDescription")] ref_Department ref_Department) { if (ModelState.IsValid) { db.ref_Department.Add(ref_Department); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Department)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "SectorID,SectorCode,SectorDescription")] ref_Sector ref_Sector) { if (ModelState.IsValid) { db.ref_Sector.Add(ref_Sector); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_Sector)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "ProjCatID,ProjCategoryCode,ProjCategoryDescription")] ref_ProjectCategory ref_ProjectCategory) { if (ModelState.IsValid) { db.ref_ProjectCategory.Add(ref_ProjectCategory); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_ProjectCategory)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "PopCitizenSexID,CountryID,GenderID,NumberofHousehold,YearTaken")] PopulationByCitizenshipGender populationByCitizenshipGender) { if (ModelState.IsValid) { db.PopulationByCitizenshipGenders.Add(populationByCitizenshipGender); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(populationByCitizenshipGender)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "DayTypeID,DayTypeCode,DayTypeDescription")] ref_DayType ref_DayType) { if (ModelState.IsValid) { db.ref_DayType.Add(ref_DayType); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_DayType)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "StratPriorityClassID,StrategicPriorityClassification")] ref_StrategicPriorityClassification ref_StrategicPriorityClassification) { if (ModelState.IsValid) { db.ref_StrategicPriorityClassification.Add(ref_StrategicPriorityClassification); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_StrategicPriorityClassification)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "AccountCodeID,FunctionID,ProgramID,AccountCode,AccountDescription")] ref_AccountCode ref_AccountCode) { if (ModelState.IsValid) { db.ref_AccountCode.Add(ref_AccountCode); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(ref_AccountCode)); }
public ActionResult Create([Bind(Prefix = "Item1", Include = "EstablishID,IndustryClassID,NumberofFirms,PercentFirms,Investment,PercentInvest,NumberofEmployee,Distribution,YearTaken")] EstablishmentByIndustry establishmentByIndustry) { if (ModelState.IsValid) { db.EstablishmentByIndustries.Add(establishmentByIndustry); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(establishmentByIndustry)); }