Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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
        }
Ejemplo n.º 10
0
        public ActionResult EditEmployee(EmployeeModel model)
        {
            _empServices = new EmployeeServices();
            _empServices.UpdateEmp(model);

            return(RedirectToAction("List"));
        }
Ejemplo n.º 11
0
        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));
        }
Ejemplo n.º 12
0
        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();
        }
Ejemplo n.º 13
0
        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!!");
            }
        }
Ejemplo n.º 14
0
        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));
            }
        }
Ejemplo n.º 15
0
        public ActionResult EditEmployee(int Id)
        {
            _empServices = new EmployeeServices();
            var model = _empServices.GetEditById(Id);

            return(View(model));
        }
Ejemplo n.º 16
0
 /// <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();
 }
Ejemplo n.º 19
0
        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));
        }
Ejemplo n.º 21
0
        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));
        }
Ejemplo n.º 22
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            return(View());
        }
Ejemplo n.º 23
0
        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));
        }
Ejemplo n.º 24
0
        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));
        }
Ejemplo n.º 25
0
        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));
        }
Ejemplo n.º 26
0
        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));
        }
Ejemplo n.º 27
0
        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));
        }
Ejemplo n.º 28
0
        public ActionResult List()
        {
            _empServices = new EmployeeServices();
            var model = _empServices.GetEmployeeList();

            return(View(model));
        }
Ejemplo n.º 29
0
        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));
        }
Ejemplo n.º 30
0
        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();
 }