public ActionResult Create([Bind(Include = "CastCode,ReligionID,CastName")] CastMaster CastMasters) { //if (ModelState.IsValid) //{ // db.CastMasters.Add(CastMasters); // db.SaveChanges(); // return RedirectToAction("Index"); //} //ViewBag.ReligionID = new SelectList(db.ReligionMaster, "ReligionID", "ReligionShortName", CastMasters.ReligionID); //return View(CastMasters); if (ModelState.IsValid) { bool isValid = db.CastMasters.Any(x => x.ReligionID == CastMasters.ReligionID && x.CastName == CastMasters.CastName); if (!isValid) { db.CastMasters.Add(CastMasters); db.SaveChanges(); ViewBag.success = "Cast Name is Successfully created!"; ModelState.Clear(); ViewBag.ReligionID = new SelectList(db.ReligionMasters, "ReligionID", "ReligionName", CastMasters.ReligionID); return(View()); } else { ViewBag.error = "Sorry! Cast Name is already exist!"; ViewBag.ReligionID = new SelectList(db.ReligionMasters, "ReligionID", "ReligionName", CastMasters.ReligionID); return(View(CastMasters)); } } ViewBag.ReligionID = new SelectList(db.ReligionMasters, "ReligionID", "ReligionName", CastMasters.ReligionID); return(View(CastMasters)); }
public ActionResult Create([Bind(Include = "Category_ID,Category_Name,Grade_Name,Grade_Detail")] HRMS_CATEGORY_GRADE hRMS_CATEGORY_GRADE) { if (ModelState.IsValid) { var category_name = db.HRMS_CATEGORY_GRADE.FirstOrDefault(rec => rec.Category_Name == hRMS_CATEGORY_GRADE.Category_Name); if (category_name != null) { var grade_name = db.HRMS_CATEGORY_GRADE.FirstOrDefault(rec => rec.Grade_Name == hRMS_CATEGORY_GRADE.Grade_Name); if (grade_name != null) { ViewBag.Grade_Status = "Grade name is Already exist in the same category !"; return(View()); } db.HRMS_CATEGORY_GRADE.Add(hRMS_CATEGORY_GRADE); db.SaveChanges(); ViewBag.Grade_Status = "Grade is added Successfuly."; return(View(hRMS_CATEGORY_GRADE)); } db.HRMS_CATEGORY_GRADE.Add(hRMS_CATEGORY_GRADE); db.SaveChanges(); ViewBag.Grade_Status = "Grade is added Successfuly."; return(View(hRMS_CATEGORY_GRADE)); } return(View(hRMS_CATEGORY_GRADE)); }
public ActionResult Create([Bind(Include = "ID,Short_Name,Name,Description")] HRMS_Travel_type hRMS_Travel_type) { if (ModelState.IsValid) { HRMS_Travel_type short_typealready = db.HRMS_Travel_type.Where(rec => rec.Short_Name == hRMS_Travel_type.Short_Name).FirstOrDefault(); if (short_typealready == null) { HRMS_Travel_type type_name_already = db.HRMS_Travel_type.Where(rec => rec.Name == hRMS_Travel_type.Name).FirstOrDefault(); if (type_name_already == null) { db.HRMS_Travel_type.Add(hRMS_Travel_type); db.SaveChanges(); ModelState.Clear(); ViewBag.TypeStatus = "New Travel Type is added successfully."; return(View()); } else { ViewBag.TypeStatus = "The name is already exist in another travel type!"; return(View()); } } else { ViewBag.TypeStatus = "The short name is already exist in another travel type!"; return(View()); } } return(View(hRMS_Travel_type)); }
public IHttpActionResult PutUserMasters(int id, tblUserMaster UserMaster) { if (id != UserMaster.UserID) { return(BadRequest()); } db.Entry(UserMaster).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserMastersExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutEmployee(string id, Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.ID) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
//Apply leave public int ApplyLeave(LeaveStatu leavestatus) { //obj.LeaveStatus(leavestatus); obj.LeaveStatus.Add(leavestatus); obj.SaveChanges(); return(leavestatus.ID); }
public ActionResult Create([Bind(Include = "ID,Cost_Cntr_Code,Cost_Cntr_Name,Parent_Cost_Cntr_Code,Ledger_Code")] HRMS_COST_CENTER hRMS_COST_CENTER) { if (ModelState.IsValid) { var existData = db.HRMS_COST_CENTER.FirstOrDefault(rec => rec.Cost_Cntr_Code == hRMS_COST_CENTER.Cost_Cntr_Code && rec.Cost_Cntr_Name == hRMS_COST_CENTER.Cost_Cntr_Name); if (existData == null) { var existCode = db.HRMS_COST_CENTER.FirstOrDefault(rec => rec.Cost_Cntr_Code == hRMS_COST_CENTER.Cost_Cntr_Code); if (existCode == null) { var ExistName = db.HRMS_COST_CENTER.FirstOrDefault(rec => rec.Cost_Cntr_Name == hRMS_COST_CENTER.Cost_Cntr_Name); if (ExistName == null) { db.HRMS_COST_CENTER.Add(hRMS_COST_CENTER); db.SaveChanges(); ViewBag.cost_Status = "New Cost added succcessfully."; return(View()); } ViewBag.cost_Status = "This Cost Name is Already Exist ! "; return(View()); } ViewBag.cost_Status = "This Cost code is already exist !"; return(View()); } ViewBag.cost_Status = "this cost Code and Name is already exist !"; return(View()); } return(View(hRMS_COST_CENTER)); }
public ActionResult Create([Bind(Include = "ID,FacultyType,EMP_ID,External_Name,PAN_No,ServiceTaxNo,Qualification,Contact,Email,Remark,IsActive,Empty")] HRMS_Faculty_MS hRMS_Faculty_MS) { if (ModelState.IsValid) { if (hRMS_Faculty_MS.FacultyType == "Internal" && hRMS_Faculty_MS.EMP_ID != null) { bool IsExist = db.HRMS_Faculty_MS.Any(x => x.EMP_ID == hRMS_Faculty_MS.EMP_ID); if (IsExist) { ViewBag.error = "Faculty type already assigned to this Employee!"; ModelState.Clear(); return(View()); } else { HRMS_Emp_Details obj = db.HRMS_Emp_Details.Where(x => x.EMP_ID == hRMS_Faculty_MS.EMP_ID).FirstOrDefault(); string name = obj.First_Name + " " + obj.Last_Name; hRMS_Faculty_MS.External_Name = name; db.HRMS_Faculty_MS.Add(hRMS_Faculty_MS); db.SaveChanges(); ModelState.Clear(); ViewBag.success = "Successfully Faculty type assigned to this Employee!"; return(View()); } } db.HRMS_Faculty_MS.Add(hRMS_Faculty_MS); db.SaveChanges(); ModelState.Clear(); ViewBag.success = "Successfully Faculty type assigned to this Employee!"; return(View()); } return(View(hRMS_Faculty_MS)); }
public ActionResult Create([Bind(Include = "ReligionID,ReligionShortName,ReligionName")] ReligionMaster religionMaster) { if (ModelState.IsValid) { bool isValid = db.ReligionMaster.Any(x => x.ReligionShortName == religionMaster.ReligionShortName || x.ReligionName == religionMaster.ReligionName); if (!isValid) { db.ReligionMaster.Add(religionMaster); db.SaveChanges(); ViewBag.success = "Religion is Successfully created!"; ModelState.Clear(); return(View()); } else { if (db.ReligionMaster.Any(x => x.ReligionName == religionMaster.ReligionName)) { ViewBag.error = "Sorry! Religion name is already exist!"; return(View(religionMaster)); } else { ViewBag.error = "Sorry! Religion Short Name is already exist!"; return(View(religionMaster)); } } } return(View(religionMaster)); }
public ActionResult Create([Bind(Include = "UnitCode,UnitName,Address,Country,City,Pincode,Priority,PaySlip,IsActive,State")] UnitMaster unitMaster) { if (ModelState.IsValid) { bool isValid = db.UnitMasters.Any(x => x.UnitName == unitMaster.UnitName || x.Priority == unitMaster.Priority); if (!isValid) { unitMaster.IsActive = true; db.UnitMasters.Add(unitMaster); db.SaveChanges(); ViewBag.success = "Unit is Successfully created!"; ModelState.Clear(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View()); } else { ViewBag.error = "Sorry! Unitname is already exist!"; long cid = db.Countries.Where(x => x.CountryName == unitMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.States.Where(x => x.StateName == unitMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.States.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.Cities.Where(x => x.StateID == sid), "CityName", "CityName"); return(View(unitMaster)); } } ViewBag.Country = new SelectList(db.Countries, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View(unitMaster)); }
public IHttpActionResult PutHoliday(int id, tblHoliday holiday) { if (id != holiday.ID) { return(BadRequest()); } db.Entry(holiday).State = EntityState.Modified; holiday.HOLIDAY_DAY = holiday.HOLIDAY_DATE.DayOfWeek.ToString(); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HolidayExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutProjects(int id, tblProject project) { if (id != project.ID) { return(BadRequest()); } db.Entry(project).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "CitizenShip_ID,CitizenShip_Country_NM")] HRMS_EMP_CITIZENSHIP_MS hRMS_EMP_CITIZENSHIP_MS) { if (ModelState.IsValid) { bool isValid = db.HRMS_EMP_CITIZENSHIP_MS.Any(x => x.CitizenShip_Country_NM == hRMS_EMP_CITIZENSHIP_MS.CitizenShip_Country_NM); if (!isValid) { db.HRMS_EMP_CITIZENSHIP_MS.Add(hRMS_EMP_CITIZENSHIP_MS); db.SaveChanges(); ViewBag.success = "It is Successfully Added!"; ModelState.Clear(); return(View()); } else { ViewBag.success = "Sorry! It is already exist!"; return(View(hRMS_EMP_CITIZENSHIP_MS)); } //db.HRMS_EMP_CITIZENSHIP_MS.Add(hRMS_EMP_CITIZENSHIP_MS); //db.SaveChanges(); //ModelState.Clear(); //return RedirectToAction("Index"); } return(View(hRMS_EMP_CITIZENSHIP_MS)); }
public IHttpActionResult PutTaskHistory(int task_id, tblTaskHistory taskHistory) { if (task_id != taskHistory.TASK_ID) { return(BadRequest()); } db.Entry(taskHistory).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TaskHistoryExists(task_id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "Mode_ID,Mode_Type,Mode_Name,Mode_Short_Name")] HRMS_TravelMode_MS hRMS_TravelMode_MS) { if (ModelState.IsValid) { bool isValid = db.HRMS_TravelMode_MS.Any(x => (x.Mode_Name == hRMS_TravelMode_MS.Mode_Name || x.Mode_Short_Name == hRMS_TravelMode_MS.Mode_Short_Name)); if (!isValid) { db.HRMS_TravelMode_MS.Add(hRMS_TravelMode_MS); db.SaveChanges(); ViewBag.success = "Travel Mode is Successfully Added!"; ModelState.Clear(); return(View()); } else { if (db.HRMS_TravelMode_MS.Any(x => x.Mode_Name == hRMS_TravelMode_MS.Mode_Name)) { ViewBag.error = "Sorry! Mode Name is already exist!"; return(View(hRMS_TravelMode_MS)); } else { ViewBag.error = "Sorry! Mode Short Name is already exist!"; return(View(hRMS_TravelMode_MS)); } } } return(View(hRMS_TravelMode_MS)); }
public ActionResult Create([Bind(Include = "Skill_ID,Skill_Name,Skill_Remark")] HRMS_TRAINING_SKILL_MS hRMS_TRAINING_SKILL_MS) { if (ModelState.IsValid) { ViewBag.Status = ""; var existData = db.HRMS_TRAINING_SKILL_MS.FirstOrDefault(rec => rec.Skill_Name == hRMS_TRAINING_SKILL_MS.Skill_Name && rec.Skill_Remark == hRMS_TRAINING_SKILL_MS.Skill_Remark); if (existData == null) { //var ExistRemark = db.HRMS_TRAINING_SKILL_MS.FirstOrDefault(rec => rec.Skill_Remark == hRMS_TRAINING_SKILL_MS.Skill_Remark); //if (ExistRemark == null) //{ db.HRMS_TRAINING_SKILL_MS.Add(hRMS_TRAINING_SKILL_MS); db.SaveChanges(); ModelState.Clear(); ViewBag.Status = "New Skill added succcessfully."; return(View()); //} //ViewBag.Status = "This Remark is Already Exist ! "; //return View(); } ViewBag.Status = "this Skill is already exist !"; return(View()); } return(View(hRMS_TRAINING_SKILL_MS)); }
public ActionResult Create([Bind(Include = "Designation_ID,Designation_Parent,Designation_ShortName,Designation_Name")] HRMS_EMP_DESIGNATION_MS hRMS_EMP_DESIGNATION_MS) { HRMS_EMP_DESIGNATION_MS h1 = db.HRMS_EMP_DESIGNATION_MS.Where(rec => rec.Designation_ID != 0).FirstOrDefault(); List <HRMS_EMP_DESIGNATION_MS> h2 = db.HRMS_EMP_DESIGNATION_MS.ToList(); dynamic MultiView = new ExpandoObject(); MultiView.data = h1; MultiView.list1 = h2; HRMS_EMP_DESIGNATION_MS hed = new HRMS_EMP_DESIGNATION_MS(); string D_parent = Request["D_parent"]; string D_name = Request["D_name"]; if (D_parent == "" || D_parent == null) { if (db.HRMS_EMP_DESIGNATION_MS.Where(rec => rec.Designation_Parent == D_name).Any()) { ViewBag.message = "Designation Already exist !!!!!!!"; } else { hed.Designation_Parent = Request["D_name"]; hed.Designation_ShortName = Request["D_shortname"]; hed.Designation_Name = Request["D_name"]; db.HRMS_EMP_DESIGNATION_MS.Add(hed); db.SaveChanges(); ViewBag.message = "Designation Added as parent !!!!!!!"; } } else if (db.HRMS_EMP_DESIGNATION_MS.Where(rec => rec.Designation_Parent == D_parent && rec.Designation_Name == D_name).Any()) { ViewBag.message = "Designation Relationship already existed !!!!!!!"; } else { if (D_parent == D_name) { ViewBag.message = "Not Valid Relationship !!!!!!!"; } else { hed.Designation_Parent = Request["D_parent"]; hed.Designation_ShortName = Request["D_shortname"]; hed.Designation_Name = Request["D_name"]; db.HRMS_EMP_DESIGNATION_MS.Add(hed); db.SaveChanges(); ViewBag.message = "Added !!!!!!!"; } } // return RedirectToAction("Index"); return(View("Create", MultiView)); }
public ActionResult Vieww(HRMS_TrainingApproval obj) { obj.Status = 1; //pending request db.HRMS_TrainingApproval.Add(obj); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Revieww(IEnumerable <string> Answer, IEnumerable <long> Question, IEnumerable <string> flag, String Textt, string Check) { //Answer.Zip(Question, Tuple.Create) //a:answer //b:question //c:flag long ProID = Convert.ToInt64(TempData["ProgramID"]); if (Textt == "") { TempData["Error"] = "Please!Fill the Rating!"; return(RedirectToAction("Review", new { id = ProID })); } long empid = Convert.ToInt64(Session["id"]); // long ProID =Convert.ToInt64(TempData["ProgramID"]); var results = Answer.ZipThree(Question, flag, (a, b, c) => new { a, b, c }); foreach (var item in results) { HRMS_TrainingReview obj = new HRMS_TrainingReview(); obj.Emp_ID = empid; obj.ProgramID = ProID; obj.QuestionID = item.b; obj.Date = DateTime.Now; obj.OtherComments = Textt; if (Check != null) { obj.IsWorthy = true; } else { obj.IsWorthy = false; } if (item.c == "False") //dropdown { obj.NonDescriptive = Convert.ToInt32(item.a); } else { obj.Descriptive = item.a; } db.HRMS_TrainingReview.Add(obj); db.SaveChanges(); } //flag insert in trainingApproval HRMS_TrainingApproval TA = db.HRMS_TrainingApproval.Where(x => x.Program_ID == ProID && x.EMP_ID == empid).FirstOrDefault(); TA.IsReviewDone = 1; //Review Done db.Entry(TA).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Gender_ID,Gender_Value")] HRMS_EMP_GENDER_MS hRMS_EMP_GENDER_MS) { if (ModelState.IsValid) { db.HRMS_EMP_GENDER_MS.Add(hRMS_EMP_GENDER_MS); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hRMS_EMP_GENDER_MS)); }
public ActionResult Create([Bind(Include = "CitizenShip_ID,CitizenShip_Country_NM")] HRMS_EMP_CITIZENSHIP_MS hRMS_EMP_CITIZENSHIP_MS) { if (ModelState.IsValid) { db.HRMS_EMP_CITIZENSHIP_MS.Add(hRMS_EMP_CITIZENSHIP_MS); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hRMS_EMP_CITIZENSHIP_MS)); }
public ActionResult Create([Bind(Include = "Travel_Other_Details_ID,Travel_Other_Details_NM")] HRMS_TRAVEL_OTHER_DETAILS_MS hRMS_TRAVEL_OTHER_DETAILS_MS) { if (ModelState.IsValid) { db.HRMS_TRAVEL_OTHER_DETAILS_MS.Add(hRMS_TRAVEL_OTHER_DETAILS_MS); db.SaveChanges(); ModelState.Clear(); return(RedirectToAction("Index")); } return(View(hRMS_TRAVEL_OTHER_DETAILS_MS)); }
public ActionResult Create([Bind(Include = "Meal_Expense_ID,Meal_Expense_NM,Meal_Expense_Status")] HRMS_TRAVEL_MEAL_EXPENSE_MS hRMS_TRAVEL_MEAL_EXPENSE_MS) { if (ModelState.IsValid) { db.HRMS_TRAVEL_MEAL_EXPENSE_MS.Add(hRMS_TRAVEL_MEAL_EXPENSE_MS); db.SaveChanges(); ModelState.Clear(); return(RedirectToAction("Index")); } return(View(hRMS_TRAVEL_MEAL_EXPENSE_MS)); }
public JsonResult AddFacultyy(string facid, string proid) { db.Configuration.ProxyCreationEnabled = false; //adding into table long fac_id = Convert.ToInt64(facid); long pro_id = Convert.ToInt64(proid); bool IsExist = db.HRMS_ProgramFaculty.Any(x => x.ProgramID == pro_id && x.FacultyID == fac_id); if (!IsExist) { HRMS_Faculty_MS obj = db.HRMS_Faculty_MS.Where(x => x.ID == fac_id).FirstOrDefault(); HRMS_ProgramFaculty obj1 = new HRMS_ProgramFaculty(); obj1.FacultyID = fac_id; obj1.FacultyName = obj.External_Name; obj1.Email = obj.Email; obj1.ProgramID = pro_id; db.HRMS_ProgramFaculty.Add(obj1); db.SaveChanges(); //List<HRMS_ProgramFaculty> FacList = db.HRMS_ProgramFaculty.Where(x => x.ProgramID == pro_id).ToList(); var FacList = pro_id; return(Json(FacList, JsonRequestBehavior.AllowGet)); } else { var FacList = "Faculty Already Exist!"; return(Json(FacList, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(HRMS_EMP_BUSINESSDIVISION_MS hRMS_EMP_BUSINESSDIVISION_MS) { ViewBag.message = ""; HRMS_EMP_BUSINESSDIVISION_MS hebd = new HRMS_EMP_BUSINESSDIVISION_MS(); string BD_name1 = Request["BD_name"]; string BD_sapcode1 = (Request["BD_sapcode"]); if (BD_name1 != null && BD_name1 != "" && BD_sapcode1 != "" && BD_sapcode1 != null) { string BD_name = Request["BD_name"]; long BD_sapcode = Convert.ToInt64(Request["BD_sapcode"]); if (db.HRMS_EMP_BUSINESSDIVISION_MS.Where(rec => rec.BusinessDivision_Name == BD_name && rec.BusinessDivision_SapCode == BD_sapcode).Any()) { ViewBag.message = "SAPCODE for this BUSINESS DIVISION Already Exist !!!!!"; return(View(hRMS_EMP_BUSINESSDIVISION_MS)); } else { if (db.HRMS_EMP_BUSINESSDIVISION_MS.Where(rec => rec.BusinessDivision_Name == BD_name).Any()) { ViewBag.message = "BUSINESS DIVISION Already Exist !!!!!"; return(View(hRMS_EMP_BUSINESSDIVISION_MS)); } else if (db.HRMS_EMP_BUSINESSDIVISION_MS.Where(rec => rec.BusinessDivision_SapCode == BD_sapcode).Any()) { ViewBag.message = "SAP CODE Already allocated !!!!!"; return(View(hRMS_EMP_BUSINESSDIVISION_MS)); } else { hebd.BusinessDivision_Name = BD_name; hebd.BusinessDivision_SapCode = BD_sapcode; db.HRMS_EMP_BUSINESSDIVISION_MS.Add(hebd); db.SaveChanges(); ModelState.Clear(); return(RedirectToAction("Index")); } } } else { ViewBag.message = "please fill up all value !!!!!"; } return(View()); }
public ActionResult _New(Branch branch) { string msg = ""; sess = (Session_CRM)Session["CRM_Session"]; var UserID = sess.User.UserID; if (branch.BranchID == 0 || branch.BranchID == null) { Branch _branch = new Branch(); _branch.Name = branch.Name; _branch.CreatedBy = UserID; _branch.CreateDate = DateTime.Now; _branch.IsActive = true; db.Branches.Add(_branch); db.SaveChanges(); } else { } List <Branch> brnch = new List <Branch>(); try { brnch = db.Branches.Where(x => x.IsActive == true).ToList(); } catch (Exception ex) { err.WriteError(ex); } return(PartialView("_Index", brnch)); }
public ActionResult Save(AT_Pages peg) { string msg = ""; try { Session_CRM sess = (Session_CRM)Session["CRM_Session"]; if (peg.PageID > 0) { db.AT_Pages.Attach(peg); db.UpdateExcept <AT_Pages>(peg); } else { db.Entry(peg).State = System.Data.Entity.EntityState.Added; } db.SaveChanges(); msg = "Page saved successfully!"; } catch (Exception ex) { msg = ex.Message; } ViewBag.msg = msg; db = new HRMSEntities(); return(PartialView("_Index", db.AT_Pages.ToList())); }
public ActionResult Create([Bind(Include = "Emp_ID,Emp_Cd,Old_Emp_Cd,Join_Date,Card_Id,salutation,First_Name,Middle_Name,Last_Name,Display_Name,Designation,Work_Location,Unit,Department,Cost_Center,UAN_No_")] HRMS_Emp_Details hRMS_Emp_Details) { if (ModelState.IsValid) { db.HRMS_Emp_Details.Add(hRMS_Emp_Details); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Cost_Center = new SelectList(db.HRMS_COST_CENTER, "ID", "Cost_Cntr_Name", hRMS_Emp_Details.Cost_Center); ViewBag.Department = new SelectList(db.HRMS_DEPT, "Dept_Id", "Dept_Name", hRMS_Emp_Details.Department); ViewBag.Designation = new SelectList(db.HRMS_EMP_DESIGNATION_MS, "Designation_ID", "Designation_Parent", hRMS_Emp_Details.Designation); ViewBag.salutation = new SelectList(db.HRMS_SALUTATION, "Salutation_ID", "Salutation_Name", hRMS_Emp_Details.salutation); ViewBag.Unit = new SelectList(db.UnitMasters, "UnitCode", "UnitName", hRMS_Emp_Details.Unit); ViewBag.Work_Location = new SelectList(db.WorkLocationMasters, "WorkID", "WorkLocationName", hRMS_Emp_Details.Work_Location); return(View(hRMS_Emp_Details)); }
public ActionResult Create([Bind(Include = "ID,Gender,DOB,Category,IdentityMark1,IdentityMark2,Religion,Citizenship,Caste,Race,MarraigeStatus,MarraigeDate,NoOfChild,NoOfDependents,AadharNo,SIN,AKA,MilitaryService,BirthCity,Note,Hobbies,MilitaryServiceDetail,EmployeeID")] Employee_Personal_Detail employee_Personal_Detail) { if (ModelState.IsValid) { db.Employee_Personal_Detail.Add(employee_Personal_Detail); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Caste = new SelectList(db.CastMasters, "CastCode", "CastName", employee_Personal_Detail.Caste); ViewBag.Category = new SelectList(db.HRMS_CATEGORY_GRADE, "Category_ID", "Category_Name", employee_Personal_Detail.Category); ViewBag.Citizenship = new SelectList(db.HRMS_EMP_CITIZENSHIP_MS, "CitizenShip_ID", "CitizenShip_Country_NM", employee_Personal_Detail.Citizenship); ViewBag.Gender = new SelectList(db.HRMS_EMP_GENDER_MS, "Gender_ID", "Gender_Value", employee_Personal_Detail.Gender); ViewBag.MarraigeStatus = new SelectList(db.MaritalMasters, "MaritalID", "MaritalName", employee_Personal_Detail.MarraigeStatus); ViewBag.Religion = new SelectList(db.ReligionMasters, "ReligionID", "ReligionShortName", employee_Personal_Detail.Religion); return(View(employee_Personal_Detail)); }
public ActionResult Create([Bind(Include = "ApplicationId,request_date,EmpID,designationID,DepartmentId,Training_Name,TrainingDetails,ApprovedDate,Status,ApprovedBy_ID,Approved_Remarks,Skill")] HRMS_Training_Request_Application hRMS_Training_Request_Application) { long emp_id = Convert.ToInt64(Session["id"]); HRMS_Emp_Details employeedetail = db.HRMS_Emp_Details.Where(rec => rec.EMP_ID == emp_id).FirstOrDefault(); hRMS_Training_Request_Application.EmployeeName = employeedetail.Display_Name; hRMS_Training_Request_Application.designationID = employeedetail.Designation; hRMS_Training_Request_Application.DepartmentId = employeedetail.Department; if (ModelState.IsValid) { var existTrainingName = db.HRMS_Training_Request_Application.Where(rec => rec.Training_Name == hRMS_Training_Request_Application.Training_Name && rec.EmpID == hRMS_Training_Request_Application.EmpID).FirstOrDefault(); if (existTrainingName == null) { hRMS_Training_Request_Application.Status = 0; db.HRMS_Training_Request_Application.Add(hRMS_Training_Request_Application); db.SaveChanges(); ViewBag.RequestStatus = "Training Request is Added successfully."; ViewBag.Department = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true); ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true); ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name"); return(View()); } else { ViewBag.RequestStatus = "This Training Request is already exist!"; ViewBag.Department = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true); ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true); ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name"); return(View()); } } //ViewBag.EmpID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.EmpID); //ViewBag.ApprovedBy_ID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.ApprovedBy_ID); //ViewBag.DepartmentId = new SelectList(db.HRMS_DEPT, "Dept_Id", "Dept_Name", hRMS_Training_Request_Application.DepartmentId); //ViewBag.designationID = new SelectList(db.HRMS_DESG_MS, "Desg_Id", "Desg_Name", hRMS_Training_Request_Application.designationID); //ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name", hRMS_Training_Request_Application.Skill); ViewBag.Department = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true); ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true); ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name"); return(View(hRMS_Training_Request_Application)); }