public void UpdateEmployee(string name, string email, string Role, string UserId)
        {
            var employee = GetEmployee(UserId);

            if (Role == "Driver")
            {
                var driver = DriverRepository.GetById(employee.Id);
                driver.SetName(name);
                driver.SetEmail(email);
                DriverRepository.Update(driver);
            }
            else if (Role == "Supervisor")
            {
                var supervisor = SupervisorRepository.GetById(employee.Id);
                supervisor.SetEmail(email);
                supervisor.SetName(name);
                SupervisorRepository.Update(supervisor);
            }
            else if (Role == "Dispatcher")
            {
                var dispatcher = DispatcherRepository.GetById(employee.Id);
                dispatcher.SetName(name);
                dispatcher.SetEmail(email);
                DispatcherRepository.Update(dispatcher);
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("SupervisorId,SupervisorFirstName,SupervisorLastName,SupervisorTitle,ExtensionNumber,FirstAid")] SupervisorEditViewModel supervisorEditViewModel)
        {
            if (id != supervisorEditViewModel.SupervisorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var supervisor = _mapper.Map <Supervisor>(supervisorEditViewModel);
                    await _supervisorRepository.Update(supervisor);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupervisorExists(supervisorEditViewModel.SupervisorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(supervisorEditViewModel));
        }
        public IActionResult EditSupervisor(int Id, SupervisorVM supervisor)
        {
            var edit = _supervisorRepository.Update(supervisor, Id);

            if (edit > 0)
            {
                return(Ok(edit));
            }
            return(BadRequest("Edit Supervisor is failed"));
        }
Beispiel #4
0
        private void Update()
        {
            Security objSecurity      = new Security();
            var      vtxtLName        = txtLName.Text;
            var      vtxtSuffix       = txtSuffix.Text;
            var      vtxtFName        = txtFName.Text;
            var      vtxtMName        = txtMName.Text;
            var      vtxtAddress_1    = txtAddress_1.Text;
            var      vtxtCity_1       = txtCity_1.Text;
            var      vtxtState_1      = txtState_1.Text;
            var      vtxtZipCode_1    = txtZipCode_1.Text;
            var      vtxtAddress_2    = txtAddress_2.Text;
            var      vtxtCity_2       = txtCity_2.Text;
            var      vtxtState_2      = txtState_2.Text;
            var      vtxtZipcode_2    = txtZipcode_2.Text;
            var      vtxtPhone        = txtPhone.Text;
            var      vtxtEmailAddress = txtEmailAddress.Text;
            var      vtxtDOB          = txtDOB.Text;
            var      vtxtSSNO         = txtSSNO.Text;
            var      vtxtACCID        = txtACCID.Text;
            var      vtxtAccreditationExpirationDate = !string.IsNullOrWhiteSpace(txtAccreditationExpirationDate.Text) ? DateTime.Parse(txtAccreditationExpirationDate.Text) : default(DateTime);
            var      vtxtConstTradeSteelStartDate    = !string.IsNullOrWhiteSpace(txtConstTradeSteelStartDate.Text) ? DateTime.Parse(txtConstTradeSteelStartDate.Text) : default(DateTime);
            var      vtxtConstTradeSteelEndDate      = !string.IsNullOrWhiteSpace(txtConstTradeSteelEndDate.Text) ? DateTime.Parse(txtConstTradeSteelEndDate.Text) : default(DateTime);
            var      vtxtSteelSuperWorkedFor         = txtSteelSuperWorkedFor.Text;
            var      vtxtThirdPartyRemovalDate       = !string.IsNullOrWhiteSpace(txtThirdPartyRemovalDate.Text) ? DateTime.Parse(txtThirdPartyRemovalDate.Text) : default(DateTime);
            var      vtxtConstTradeRemovalStartDate  = !string.IsNullOrWhiteSpace(txtConstTradeRemovalStartDate.Text) ? DateTime.Parse(txtConstTradeRemovalStartDate.Text) : default(DateTime);
            var      vtxtConstTradeRemovalEndDate    = !string.IsNullOrWhiteSpace(txtConstTradeRemovalEndDate.Text) ? DateTime.Parse(txtConstTradeRemovalEndDate.Text) : default(DateTime);
            var      vtxtRemovalSuperWorkedFor       = txtRemovalSuperWorkedFor.Text;
            var      vtxtConstTradeRepaintStartDate  = !string.IsNullOrWhiteSpace(txtConstTradeRepaintStartDate.Text) ? DateTime.Parse(txtConstTradeRepaintStartDate.Text) : default(DateTime);
            var      vtxtConstTradeRepaintEndDate    = !string.IsNullOrWhiteSpace(txtConstTradeRepaintEndDate.Text) ? DateTime.Parse(txtConstTradeRepaintEndDate.Text) : default(DateTime);
            var      vtxtRepaintSuperWorkedFor       = txtRepaintSuperWorkedFor.Text;
            var      vchkWaiver               = chkWaiver.Checked;
            var      vtxtTrainingCardNum      = txtTrainingCardNum.Text;
            var      vtxtTrainCExpire         = txtTrainCExpire.Text;
            var      vtxtTrainingProviderName = txtTrainingProviderName.Text;
            var      vtxtCourseName           = txtCourseName.Text;
            var      vtxtCourseStartDate      = !string.IsNullOrWhiteSpace(txtCourseStartDate.Text) ? DateTime.Parse(txtCourseStartDate.Text) : default(DateTime);
            var      vtxtCourseEndDate        = !string.IsNullOrWhiteSpace(txtCourseEndDate.Text) ? DateTime.Parse(txtCourseEndDate.Text) : default(DateTime);
            var      vtxtContractorName       = txtContractorName.Text;
            var      vtxtContractorAccdNum    = txtContractorAccdNum.Text;
            var      vtxtIC_Address_Line_1    = txtIC_Address_Line_1.Text;
            var      vtxtIC_City              = txtIC_City.Text;
            var      vtxtIC_State             = txtIC_State.Text;
            var      vtxtIC_Zipcode           = txtIC_Zipcode.Text;
            var      vtxtICContactFName       = txtICContactFName.Text;
            var      vtxtICContactLName       = txtICContactLName.Text;
            var      vtxtICContactPhone       = txtICContactPhone.Text;
            var      vchkIAgree               = chkIAgree.Checked;
            var      vdropIsRenewal           = int.Parse(dropIsRenewal.SelectedItem.Value);
            var      vdropCategory            = int.Parse(dropCategory.SelectedItem.Value);

            #region Saving obj

            var id = GetId();
            if (id > 0)
            {
                var subject = _SupervisorRepository.Get(id);
                subject.Update(vtxtLName, vtxtSuffix, vtxtFName, vtxtMName, vtxtAddress_1, vtxtCity_1, vtxtState_1, vtxtZipCode_1, vtxtAddress_2, vtxtCity_2,
                               vtxtState_2, vtxtZipcode_2, vtxtPhone, vtxtEmailAddress, vtxtDOB, vtxtSSNO, vdropIsRenewal, vtxtACCID,
                               vtxtAccreditationExpirationDate, vdropCategory, vtxtConstTradeSteelStartDate, vtxtConstTradeSteelEndDate,
                               vtxtSteelSuperWorkedFor, vtxtThirdPartyRemovalDate, vtxtConstTradeRemovalStartDate, vtxtConstTradeRemovalEndDate,
                               vtxtRemovalSuperWorkedFor, vtxtConstTradeRepaintStartDate, vtxtConstTradeRepaintEndDate, vtxtRepaintSuperWorkedFor,
                               vchkWaiver, vtxtTrainingCardNum, vtxtTrainCExpire, vtxtTrainingProviderName, vtxtCourseName, vtxtCourseStartDate,
                               vtxtCourseEndDate, vtxtContractorName, vtxtContractorAccdNum, vtxtIC_Address_Line_1, vtxtIC_City, vtxtIC_State,
                               vtxtIC_Zipcode, vtxtICContactFName, vtxtICContactLName, vtxtICContactPhone, vchkIAgree);
                _SupervisorRepository.Update(subject);
                _uow.Commit();
                #endregion

                string strBackToForms = objcryptoJS.AES_encrypt("10", AppConstants.secretKey, AppConstants.initVec).ToString();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Your Application has been updated successfully!', '', 'success', 'MDESuperAppView.aspx?Superapps=active&cgi=" + Request["cgi"] + "');", true);
                //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Your Application has been updated successfully!', '', 'success', 'RoleDesc.aspx?Dash=active&cgi=" + System.Web.HttpUtility.UrlEncode(strBackToForms) + "');", true);
            }
        }