public ActionResult Create([Bind(Include = "Employee, SalaryAmount, TransferMonth, FinishedInstallmentsAmount, RemainingInstallmentsAmount, Notes")] MissingInstallmentDecrease missingInstallmentDecrease) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { MissingInstallmentDecreaseServices.Insert(CurrentUser.Id, missingInstallmentDecrease, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); return(View(missingInstallmentDecrease)); }
public ActionResult Create([Bind(Include = "Id, Employee, PaymentGroup, Month, Opening, NormalLoans, IncomingLoans, Restitution, OutgoingLoans, SalaryPayment, CashPayment")] MonthlyBalance monthlyBalance) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { MonthlyBalanceServices.Insert(CurrentUser.Id, monthlyBalance, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.PaymentGroupList = new SelectList(PaymentGroupServices.List(db), "Id", "Name"); return(View(monthlyBalance)); }
private void BtnSave_Click(object sender, EventArgs e) { int ID = int.Parse(MtxtEmpID.Text); Employee emp = new Employee(); emp.FName = MtxtFName.Text; emp.LName = MtxtLName.Text; emp.Email = MtxtEmail.Text; emp.DOB = MdtpDOB.Value; emp.Phone = MtxtPhone.Text; // call the service EmployeeServices serv = new EmployeeServices(); Status result = serv.UpdatedEmp(emp, ID); // check if detials have been saved if (result == Status.Unsuccessfull) { MessageBox.Show("Employee detials have not updated!"); } else if (result == Status.Successfull) { MessageBox.Show("Employee record are updated"); } lvEmpList.Items.Clear(); // EmployeeServices serv = new EmployeeServices(); StatusData <List <Employee> > List = serv.ListDetails(); foreach (Employee empList in List.Data) { lvEmpList.Items.Add(new ListViewItem(new string[] { empList.EmpID.ToString(), empList.FName + " " + empList.LName, empList.Email.ToString() })); } }
public ActionResult Edit([Bind(Include = "Employee, ServiceInDays")] EmployeeSeniority employeeSeniority) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { EmployeeSeniorityServices.Update(CurrentUser.Id, employeeSeniority, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName", employeeSeniority.Employee); return(View(employeeSeniority)); }
private void btnSearchByID_Click(object sender, EventArgs e) { // Get the id from txtEmpID int ID = int.Parse(MtxtEmpID.Text); // call FindEmployee method // call the service EmployeeServices serv = new EmployeeServices(); StatusData <Employee> findEmp = serv.FindEmp(ID); //Dispaly output if (findEmp.Data == null) { MessageBox.Show("Not Found"); } else { MtxtFName.Text = findEmp.Data.FName; MtxtLName.Text = findEmp.Data.LName; MtxtEmail.Text = findEmp.Data.Email; MtxtPhone.Text = findEmp.Data.Phone; MdtpDOB.Value = findEmp.Data.DOB.ToLocalTime(); } }
public ActionResult Edit([Bind(Include = "Id, FirstName, LastName, FatherName, MotherName, BirthDate, ExpectedEndDate, CersStartDate, CfStartDate, LeaveDate, LeaveReason, EmployeeStatus, Department, Notes, Category")] Employee employee) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { EmployeeServices.Update(CurrentUser.Id, employee, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.CategoryList = new SelectList(CategoryServices.List(db), "Id", "Name", employee.Category); ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name", employee.Department); ViewBag.EmployeeStatusList = new SelectList(EmployeeStatusServices.List(db), "Id", "Name", employee.EmployeeStatus); return(View(employee)); }
public ActionResult Create([Bind(Include = "Id, Employee, PaymentDate, PaymentAmount, PaymentNotes, InvoiceDate, InvoiceAmount, InvoiceNotes, InsuranceDate, InsuranceAmount, InsuranceType, InsuranceNotes, BoardDate, BoardAmount, BoardType, BoardNotes, DirectPaymentDate, DirectPaymentAmount, DirectPaymentNotes, PaymentStatus, Notes, Department, HealthLoanDecision, RequestCost, LoanRequest")] HealthLoanDecisionFirstPayment healthLoanDecisionFirstPayment) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { HealthLoanDecisionFirstPaymentServices.Insert(CurrentUser.Id, healthLoanDecisionFirstPayment, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.HealthLoanDecisionList = new SelectList(HealthLoanDecisionServices.List(db), "Id", "CersNumber"); ViewBag.InsuranceTypeList = new SelectList(InsuranceTypeServices.List(db), "Id", "Name"); return(View(healthLoanDecisionFirstPayment)); }
public ActionResult Create([Bind(Include = "Id, Employee, RequestDate, GrantType, Description, Amount, CersNumber, CersDate, PaymentNumber, PaymentDate, Notes")] ExternalGrant externalGrant) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { ExternalGrantServices.Insert(CurrentUser.Id, externalGrant, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name"); return(View(externalGrant)); }
public JsonResult GetEmployeesId(Guid id) { EmployeeServices service = new EmployeeServices(); var emp = service.GetById <Sys_UserInfoEntity>(id, ref status); var emp1 = new Sys_UserInfoEntity() { ID = emp.ID, UserLogin = emp.UserLogin, UserInfoName = emp.UserInfoName }; return(Json(emp1)); #region code cũ //EmployeeServices service = new EmployeeServices(); //var emp = service.GetEmployeesById(id); //var emp1 = new Data.HrmSystem.Model.Sys_User() //{ // Id = emp.Id, // UserLogin = emp.UserLogin, // UserName = emp.UserName //}; //return Json(emp1); #endregion }
public ActionResult EditEmployee(EmployeeModel model) { _empServices = new EmployeeServices(); _empServices.UpdateEmp(model); return(RedirectToAction("List")); }
public ActionResult Create([Bind(Include = "Id, Employee, Month, Department, SubscriptionType, Amount, Notes, IsFixed")] Subscription subscription) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { SubscriptionServices.Insert(CurrentUser.Id, subscription, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name"); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.SubscriptionTypeList = new SelectList(SubscriptionTypeServices.List(db), "Id", "Name"); return(View(subscription)); }
protected void btnD_Click(object sender, EventArgs e) { string fileName = "Employees.xls"; EmployeeServices employeeServices = new EmployeeServices(); DataGrid dg = new DataGrid { AllowPaging = false, DataSource = employeeServices.GetAllEmplyees() }; dg.DataBind(); System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.Buffer = true; System.Web.HttpContext.Current.Response.ContentEncoding = Encoding.UTF8; System.Web.HttpContext.Current.Response.Charset = ""; System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; System.IO.StringWriter stringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlTextWriter = new System.Web.UI.HtmlTextWriter(stringWriter); dg.RenderControl(htmlTextWriter); System.Web.HttpContext.Current.Response.Write(stringWriter.ToString()); System.Web.HttpContext.Current.Response.End(); }
public void AddEmployees() { DateTime thisDay = DateTime.Today; string joinYear = thisDay.Year.ToString(); string joinMonth = thisDay.Month.ToString(); string joinDay = thisDay.Day.ToString(); string birthYear = dateBirth.Value.Year.ToString(); string birthMonth = dateBirth.Value.Month.ToString(); string birthDay = dateBirth.Value.Day.ToString(); employee.EmployeeName = txtName.Text; employee.Address = txtAddress.Text; employee.Phone = txtPhone.Text; employee.Gender = comboGender.Text; employee.Education = txtEducation.Text; employee.Post = comboPost.Text; employee.Salary = Convert.ToInt32(txtSalary.Text); employee.BloodGroup = comboBloodGroup.Text; employee.Joindate = joinDay + "-" + joinMonth + "-" + joinYear; employee.Birthdate = birthDay + "-" + birthMonth + "-" + birthYear; employee.Password = txtPassword.Text; EmployeeServices employeeService = new EmployeeServices(); if (employeeService.Add(employee) == 1) { MessageBox.Show("Record Added Successfully!"); this.Close(); } else { MessageBox.Show("Could not store data!!"); } }
public ActionResult DeleteEmployee(long id) { var gVal = new GenericValidator(); try { if (id < 1) { gVal.Code = -1; gVal.Error = message_Feedback.Invalid_Selection; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var k = new EmployeeServices().DeleteEmployee(id); if (k) { gVal.Code = 5; gVal.Error = message_Feedback.Delete_Success; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -1; gVal.Error = message_Feedback.Delete_Failure; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 5; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditEmployee(int Id) { _empServices = new EmployeeServices(); var model = _empServices.GetEditById(Id); return(View(model)); }
/// <summary> /// 获取指定ID的数据 /// </summary> public ActionResult QueryOneData() { try { int id = Request.Form["id"] != "" ? int.Parse(Request.Form["id"]) : 0; var item = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.ID == id).FirstOrDefault(); item.RoleIDs = EmployeeServices.GetRoleIDs(item.ID); JsonHelper json = new JsonHelper(); string strJson = string.Empty; if (item != null) { json.AddItem("ID", item.ID.ToString()); json.AddItem("EmpNo", item.EmpNo); json.AddItem("Pwd", item.Pwd); json.AddItem("Name", item.Name); json.AddItem("Tel", item.Tel); json.AddItem("RoleIDs", item.RoleIDs); json.ItemOk(); } strJson = json.ToEasyuiOneModelJsonString(); // strJson = "[{\"ID\":\"81\",\"EmpNo\":\"jxdhlgljp\",\"Name\":\"hello\",\"Pwd\":\"111111\",\"Tel\":\"18720081979\"}]"; return(Content(strJson)); } catch (Exception ex) { throw; } }
public ActionResult EditUser(int id, UserFilterModel filter, FormCollection collection) { var user = EmployeeServices.GetUser(id); try { UpdateModel(user, "User"); EmployeeServices.UpdateUser(user); return(RedirectToAction("UserListing", filter.GenerateUserAccessRoute())); } catch (Exception ex) { // Invalid - redisplay with errors Logger.Error(ex.ToString()); ModelState.AddModelError(String.Empty, Constants.ServerError); var model = new UserDetailModel() { Action = "EditUser", User = user, Filter = filter, Roles = LookupServices.GetRoleOptions(user.RoleName) }; ViewBag.Locations = LocationServices.GetLocationLookup(true, model.User.LocationId); return(View("UserDetail", model)); } }
public EmployeeServicesDataAccessTests(ITestOutputHelper testOutputHelper) { connectionString = Properties.Settings.Default.connectionStr; employeeServices = new EmployeeServices(new EmployeeRepository(connectionString), new ModelDataAnnotationCheck()); this.testOutputHelper = testOutputHelper; testNum = new Random().Next(); }
public ActionResult Create([Bind(Include = "Id, Employee, Amount, Issuer, ReferenceNumber, Date, PeriodInMonths, ExceptionalPayment, IsActive, Notes, IssueDescription, Installment")] Debt debt) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { DebtServices.Insert(CurrentUser.Id, debt, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.IssuerList = new SelectList(IssuerServices.List(db), "Id", "Name"); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); return(View(debt)); }
public ActionResult NewUser(UserModel user, UserFilterModel filter) { try { if (ModelState.IsValid) { EmployeeServices.CreateUser(user); return(RedirectToAction("UserListing", filter.GenerateUserAccessRoute())); } } catch (Exception ex) { Logger.Error(ex.ToString()); ModelState.AddModelError(String.Empty, Constants.ServerError); } // Invalid - redisplay with errors var model = new UserDetailModel() { Action = "NewUser", User = user, Filter = filter, Roles = LookupServices.GetRoleOptions(user.RoleName) }; ViewBag.Locations = LocationServices.GetLocationLookup(true, -1); return(View("UserDetail", model)); }
public ActionResult Create([Bind(Include = "Employee, Extension, HomePhone, MobilePhone, Address")] Profile profile) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { ProfileServices.Insert(CurrentUser.Id, profile, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); return(View(profile)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); return(View()); }
public ActionResult Create([Bind(Include = "Id, RefundableProduct, SubNumber, Employee, GuarantorStatus, Notes")] Guarantor guarantor) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { GuarantorServices.Insert(CurrentUser.Id, guarantor, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name"); ViewBag.RefundableProductList = new SelectList(RefundableProductServices.List(db), "Product", "Name"); return(View(guarantor)); }
public ActionResult Edit([Bind(Include = "Id, Employee, ProductType, Amount, Notes")] Product product) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { ProductServices.Update(CurrentUser.Id, product, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName", product.Employee); ViewBag.ProductTypeList = new SelectList(ProductTypeServices.List(db), "Id", "Name", product.ProductType); return(View(product)); }
public ActionResult Create([Bind(Include = "Id, Debt, Employee, IsActive, Notes")] Warrant warrant) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { WarrantServices.Insert(CurrentUser.Id, warrant, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.DebtList = new SelectList(DebtServices.List(db), "Id", "ReferenceNumber"); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); return(View(warrant)); }
public ActionResult Create([Bind(Include = "Id, InstallmentDecreaseOrder, Employee, Department, DecreaseAmount, NewInstallmentAmount, Notes")] InstallmentDecrease installmentDecrease) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { InstallmentDecreaseServices.Insert(CurrentUser.Id, installmentDecrease, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber"); ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name"); return(View(installmentDecrease)); }
public IActionResult Edit(EditEmployeeBindingModel bm, int id) { var employee = EmployeeServices.GetEmployeeById(id); var expLevels = new[] { "A", "B", "C", "D" }; if (bm.ExperinceLevel != null && !expLevels.Contains(bm.ExperinceLevel)) { ModelState.AddModelError("ExperinceLevel", "Experince Level must be \"A\", \"B\", \"C\", \"D\""); var dtoComp = CompanyServices.GetAllCompanies(); var dto = new EditEmployeeDto() { Companies = dtoComp, Employee = employee }; return(this.View(dto)); } EditEmployee(bm, employee); this.EmployeeServices.UpdateEmployee(employee); var companies = this.CompanyServices.GetAllCompanies(); employee = EmployeeServices.GetEmployeeById(id); var employeeDto = new EditEmployeeDto() { Employee = employee, Companies = companies }; this.ViewData["edit"] = "You have successfully edited this employee!"; return(this.View(employeeDto)); }
public ActionResult List() { _empServices = new EmployeeServices(); var model = _empServices.GetEmployeeList(); return(View(model)); }
public ActionResult Create([Bind(Include = "Id, Employee, Date, PaymentGroup, Amount, Notes, PaymentStatus, CollectOrder")] Payment payment) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { PaymentServices.Insert(CurrentUser.Id, payment, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.CollectOrderList = new SelectList(CollectOrderServices.List(db), "Id", "Name"); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.PaymentGroupList = new SelectList(PaymentGroupServices.List(db), "Id", "Name"); ViewBag.PaymentStatusList = new SelectList(PaymentStatusServices.List(db), "Id", "Name"); return(View(payment)); }
public ActionResult Edit(int?id) { Db db = new Db(DbServices.ConnectionString); if (id == null) { return(RedirectToAction("Index")); } Product product = ProductServices.Get(id.Value, db); Request request = RequestServices.Get(id.Value, db); GrantRequest loanRequest = GrantRequestServices.Get(id.Value, db); if (product == null || request == null || loanRequest == null) { return(HttpNotFound()); } // For Product ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "Id_Name", product.Employee); //For Grant ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name"); GrantRequestViewModel vm = new GrantRequestViewModel(); vm.RequestProduct = product; vm.Request = request; vm.GrantRequest = loanRequest; return(View(vm)); }
protected void ButtonUpdate_Click(object sender, EventArgs e) { EmployeeServices empSrv = new EmployeeServices(); GridViewEmployees.DataSource = empSrv.GetEmployeesByDept(DropDownListDepts.SelectedItem.Text); GridViewEmployees.DataBind(); }