public ActionResult Find(int id)
        {
            EmployeeDAL   dal   = new EmployeeDAL();
            EmployeeModel model = dal.Find(id);

            return(View(model));
        }
Exemple #2
0
        public ActionResult ConfigureParameterCategories()
        {
            try
            {
                ConfigureParameterCategory configParametercategory = new ConfigureParameterCategory();
                string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);
                configParametercategory.SearchedUserDetails = new SearchedUserDetails();
                CommonMethodsDAL Commondal = new CommonMethodsDAL();
                configParametercategory.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role);
                PersonalDetailsDAL personalDAL = new PersonalDetailsDAL();
                EmployeeDAL        dal         = new EmployeeDAL();
                int employeeID = dal.GetEmployeeID(Membership.GetUser().UserName);

                configParametercategory.SearchedUserDetails.EmployeeId   = employeeID;
                configParametercategory.SearchedUserDetails.EmployeeCode = personalDAL.getEmployeeCode(employeeID);

                ConfigurationDAL           configDAL           = new ConfigurationDAL();
                List <Parametercompetency> parametercompetency = configDAL.GetParameterCategories();
                configParametercategory.RecordsCount         = parametercompetency.Count;
                configParametercategory.Parametercompetencys = parametercompetency;
                return(PartialView("_ConfigureParameterCompetency", configParametercategory));
            }
            catch
            {
                throw;
            }
        }
        public ActionResult Delete(int id)
        {
            EmployeeDAL dal    = new EmployeeDAL();
            bool        status = dal.Delete(id);

            return(View());
        }
        public ActionResult NewEmployee()
        {
            EmployeeDAL dal = new EmployeeDAL();

            ViewBag.cities = dal.Getcities();
            return(View());
        }
Exemple #5
0
        public ActionResult Index(UserDATA data)
        {
            ViewBag.Title = "Login to WorkFlow";
            ViewBag.Head  = "Welcome";

            EmployeeDAL dal = new EmployeeDAL();

            bool checkLogin = dal.CheckLogin(data.USERID, data.PASSWORD);

            if (checkLogin == true)
            {
                TempData["usernameTemp"] = data.USERID;

                Session["userid"] = data.USERID;

                return(RedirectToAction("Index", "WF"));
            }
            else
            {
                data.USERID   = "Please input Username";
                data.PASSWORD = "******";
            }

            return(View(data));
        }
        public ActionResult EmployeeApprovalsLoadGrid(int page, int rows, string term, string Module)
        {
            try
            {
                PersonalDetailsDAL dal    = new PersonalDetailsDAL();
                EmployeeDAL        empdal = new EmployeeDAL();
                EmployeeChangesApprovalViewModel objChangesApprovalModel = new Models.EmployeeChangesApprovalViewModel();
                int totalCount;
                int LoggedInEmployeeId = empdal.GetEmployeeID(Membership.GetUser().UserName);

                List <EmployeeChangesApprovalViewModel> ChangesApprovalList = dal.GetEmployeeChangeDetails(page, rows, term, Module, LoggedInEmployeeId, out totalCount);
                string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);

                if ((ChangesApprovalList == null || ChangesApprovalList.Count <= 0) && page - 1 > 0)
                {
                    page = page - 1;
                    ChangesApprovalList = dal.GetEmployeeChangeDetails(page, rows, term, Module, LoggedInEmployeeId, out totalCount);
                }

                var totalRecords = totalCount;
                var totalPages   = (int)Math.Ceiling((double)totalRecords / (double)rows);
                var jsonData     = new
                {
                    total   = totalPages,
                    page    = page,
                    records = totalRecords,
                    rows    = ChangesApprovalList,
                };
                return(Json(jsonData));
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", "Error", new { errorCode = "There are some errors." }));
            }
        }
        public static string UpdateEmployee(int ID, string adi, string soyadi, string maasi, int pozisyonu)
        {
            var f = EmployeeBLL.GetEmployeeByName(adi, soyadi).First();

            if (f.CalisanID == ID)
            {
                if (GetEmployeeToUpdate(ID, adi, soyadi, maasi, pozisyonu).Item2)
                {
                    try
                    {
                        EmployeeDAL.EmployeeCRUD(GetEmployeeToUpdate(ID, adi, soyadi, maasi, pozisyonu).Item1.ConvertToCalisan(), EntityState.Modified);
                        return("Çalışan güncellendi.");
                    }
                    catch (Exception)
                    {
                        return("Çalışan güncellenirken hata oluştu.");
                    }
                }
                else
                {
                    return("Ad ve soyad metin ,maas ve pozisyon sayısal ifadelerden oluşmalıdır.");
                }
            }
            else
            {
                return("Mevcutta var olan bir çalışan başka bir kayıtta da var olamaz.");
            }
        }
    protected void gvwList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Edit":
            Response.Redirect("Employeedetail.aspx?action=edt&id=" + e.CommandArgument);
            break;

        case "Delete":
            EmployeeDAL _dalEmployee  = null;
            Hashtable   _htParameters = null;

            try
            {
                _dalEmployee  = new EmployeeDAL();
                _htParameters = new Hashtable();

                _htParameters["p_Employee_ID"] = e.CommandArgument.ToString();

                _dalEmployee.Delete(_htParameters);
                this.BindGrid();
                Response.Redirect("Employeelist.aspx");
            }
            catch (Exception ex)
            {
                Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null);
            }
            break;
        }
    }
Exemple #9
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            IdNameDAL idNameDAL = new IdNameDAL();

            cbGender.ItemsSource      = idNameDAL.GetByCategory("性别");
            cbMarriage.ItemsSource    = idNameDAL.GetByCategory("婚姻状况");
            cbPartyStatus.ItemsSource = idNameDAL.GetByCategory("政治面貌");
            cbEducation.ItemsSource   = idNameDAL.GetByCategory("学历");
            cbDepatment.ItemsSource   = new DepartmentDAL().ListAll();

            if (IsAddNew)
            {
                Employee employee = new Employee();
                employee.InDate           = DateTime.Today;//给默认值
                employee.ContractStartDay = DateTime.Today;
                employee.ContractEndDay   = DateTime.Today.AddYears(1);
                employee.Nationality      = "汉族";
                employee.Email            = "@itcast.cn";
                //employee.Number = "YG";
                employee.Number          = new SettingDAL().GetValue("员工工号前缀");
                gridEmployee.DataContext = employee;
            }
            else
            {
                Employee employee = new EmployeeDAL().GetById(EditingId);
                gridEmployee.DataContext = employee;

                if (employee.Photo != null)
                {
                    ShowImg(employee.Photo);
                }
            }
        }
 public static string AddEmployee(string adi, string soyadi, string maasi, int pozisyonu)
 {
     if (GetEmployeeByName(adi, soyadi).Count() <= 0)
     {
         if (GetEmployeeToAdd(adi, soyadi, maasi, pozisyonu).Item2)
         {
             try
             {
                 EmployeeDAL.EmployeeCRUD(GetEmployeeToAdd(adi, soyadi, maasi, pozisyonu).Item1.ConvertToCalisan(), EntityState.Added);
                 return("Çalışan eklendi.");
             }
             catch (Exception)
             {
                 return("Çalışan eklenirken hata oluştu.");
             }
         }
         else
         {
             return("Ad ve soyad metin ,maas ve pozisyon sayısal ifadelerden oluşmalıdır.");
         }
     }
     else
     {
         return("Sistemde bu çalışan mevcut olduğundan eklenmedi.");
     }
 }
    private void SaveData()
    {
        EmployeeDAL _dalEmployee  = null;
        Hashtable   _htParameters = null;
        int         iNextID       = 0;

        try
        {
            _dalEmployee  = new EmployeeDAL();
            _htParameters = new Hashtable();

            MPF23.Shared.Mapper.UIToDB.Map(pnlBody.Controls, _htParameters);
            Utility.ApplyDefaultProp(_htParameters);

            if (Request.Params["action"] == "add")
            {
                _dalEmployee.Insert(_htParameters, ref iNextID);
            }
            else
            {
                _dalEmployee.Update(_htParameters);
                iNextID = Int32.Parse(lblEmployee_ID.Text);
            }

            Utility.ShowMessageBox(this, Utility.SAVE_DATA_SUCCESS_MESSAGE, null, "Employeedetail.aspx?action=edt&id=" + iNextID.ToString());
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.SAVE_DATA_FAIL_MESSAGE, ex, null);
        }
    }
Exemple #12
0
        //
        // GET: /Configuration/

        public ActionResult Index()
        {
            try
            {
                ConfigurationViewModel configviewmodel = new ConfigurationViewModel();
                CommonMethodsDAL       Commondal       = new CommonMethodsDAL();
                EmployeeDAL            employeeDAL     = new EmployeeDAL();
                configviewmodel.SearchedUserDetails = new SearchedUserDetails();
                ViewBag.AsciiKey = Session["SecurityKey"].ToString();
                string   employeeCode = Membership.GetUser().UserName;
                int      employeeId   = employeeDAL.GetEmployeeID(employeeCode);
                string[] role         = Roles.GetRolesForUser(employeeCode);

                if (employeeCode != null)
                {
                    configviewmodel.SearchedUserDetails.EmployeeId   = employeeId;
                    configviewmodel.SearchedUserDetails.EmployeeCode = employeeCode;
                    configviewmodel.SearchedUserDetails.UserRole     = Commondal.GetMaxRoleForUser(role);
                }

                return(View(configviewmodel));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #13
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter)
        {
            var db            = new EmployeeDAL();
            int?total         = 0;
            var baseListParam = new BaseListParam()
            {
                FilterField  = filter,
                OrderByField = "",
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                PageIndex    = pageIndex,
                PageSize     = pageSize,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var result   = db.GetEmployee(baseListParam, out total);
            var lstTotal = new TableColumnsTotalModel();

            lstTotal.Total1 = "15";
            lstTotal.Total2 = "25";
            lstTotal.Total3 = "35";
            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = lstTotal,
                hrID = baseListParam.UserId.ToString(),
                roleID = baseListParam.UserType,
                positionID = Global.CurrentUser.OfficePositionID
            })));
        }
Exemple #14
0
        public IActionResult GetEmployee()
        {
            EmployeeDAL empDAL = new EmployeeDAL();
            Employee    emp    = empDAL.GetEmployeeById(10001);

            return(Ok(emp));
        }
        public static List <Employee> GetEmployee(NameValueCollection querystring)
        {
            string criteria = querystring.Get("Criteria");
            int    branchID = int.TryParse(querystring.Get("BranchID"), out branchID) ? branchID : 0;

            return(EmployeeDAL.GetEmployee(criteria, branchID));
        }
        //*****************************************************************************


        // hien thi danh sach nhan vien
        public void HienThiDSNhanVien()
        {
            dgvtable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            EmployeeDAL empDAL = new EmployeeDAL();

            dgvEmployee.DataSource = empDAL.getListEmployee();
        }
        public static string ManageEmployee(NameValueCollection querystring)
        {
            int integerParse;
            //decimal decimalParse;

            //UserProfile userProfile = WebCommon.GetUserProfile();


            var employee = new Employee
            {
                EmployeeID         = int.TryParse(querystring.Get("EmployeeID"), out integerParse) ? integerParse : 0,
                FirstName          = querystring.Get("FirstName"),
                MiddleName         = querystring.Get("MiddleName"),
                LastName           = querystring.Get("LastName"),
                ContactNo          = querystring.Get("ContactNo"),
                Address            = querystring.Get("Address"),
                Type               = querystring.Get("Agent"),
                BranchID           = int.TryParse(querystring.Get("BranchID"), out integerParse) ? integerParse : 0,
                PositionID         = int.TryParse(querystring.Get("PositionID"), out integerParse) ? integerParse : 0,
                intIDMasBranchZone = int.TryParse(querystring.Get("intIDMasBranchZone"), out integerParse) ? integerParse : 0,
                IsActive           = querystring.Get("isActive"),
                //UserID = userProfile.UserId
            };

            string isInsert = querystring.Get("TransType");
            string param    = WebCommon.ToXML(employee);

            return(EmployeeDAL.ManageEmployee(param, isInsert));
        }
Exemple #18
0
        public ActionResult Index()
        {
            try
            {
                ConfigurationViewModel orbit       = new ConfigurationViewModel();
                EmployeeDAL            employeeDAL = new EmployeeDAL();
                orbit.SearchedUserDetails = new SearchedUserDetails();
                ViewBag.AsciiKey          = Session["SecurityKey"].ToString();

                string   employeeCode = Membership.GetUser().UserName;
                int      employeeId   = employeeDAL.GetEmployeeID(employeeCode);
                string[] role         = Roles.GetRolesForUser(employeeCode);

                if (employeeCode != null)
                {
                    orbit.SearchedUserDetails.EmployeeId = employeeId;
                    SemDAL semdal     = new SemDAL();
                    int    employeeid = semdal.geteEmployeeIDFromSEMDatabase(employeeCode);
                    orbit.SearchedUserDetails.IsProjectReviewer = semdal.CheckIfEmployeeisReviewer(employeeid);
                    orbit.SearchedUserDetails.EmployeeCode      = employeeCode;
                    orbit.SearchedUserDetails.UserRole          = Commondal.GetMaxRoleForUser(role);
                }
                return(View(orbit));
            }
            catch
            {
                throw;
            }
        }
    //-------------------------- asfor Employee 20161215_Anas -------------------------------------------
    private void BindGridPopUp()
    {
        EmployeeDAL _dalEmployee  = null;
        Hashtable   _htParameters = null;

        try
        {
            _dalEmployee  = new EmployeeDAL();
            _htParameters = new Hashtable();

            _htParameters["p_keywords"] = txtSearchEmployee.Text;
            _htParameters["p_status"]   = "1";
            string abc = Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString();
            if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "1")
            {
                _htParameters["p_Employee_Code"] = Session[SessionKey.CURRENT_USER_HRMS_EMP_CODE].ToString();
            }
            gvwListEmployee.DataSource = _dalEmployee.GetRows(_htParameters);
            gvwListEmployee.DataBind();
        }
        catch (Exception ex)
        {
            Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null);
        }
    }
Exemple #20
0
        public static bool DeleteEmployeeBL(string deleteEmployeeID)
        {
            bool employeeDeleted = false;

            try
            {
                if (Regex.IsMatch(deleteEmployeeID, "[EMP][0-9]{14}$") == true)   //matching user provided employeeID with employeeID in list
                {
                    EmployeeDAL employeeDAL = new EmployeeDAL();
                    employeeDeleted = employeeDAL.DeleteEmployeeDAL(deleteEmployeeID);   //if matched, the employee is deleted by calling DAL class method
                }
                else
                {
                    throw new PecuniaException("Invalid Employee ID");
                }
            }
            catch (PecuniaException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(employeeDeleted);
        }
Exemple #21
0
        public ActionResult Delete(string id)
        {
            EmployeeDAL objDal = new EmployeeDAL();

            objDal.DeleteById(id);
            return(RedirectToAction("Get"));
        }
Exemple #22
0
 public ActionResult Index()
 {
     try
     {
         EmployeeChangesApprovalViewModel model = new EmployeeChangesApprovalViewModel();
         EmployeeDAL employeeDAL = new EmployeeDAL();
         model.SearchedUserDetails = new SearchedUserDetails();
         string   employeeCode = Membership.GetUser().UserName;
         int      employeeId   = employeeDAL.GetEmployeeID(employeeCode);
         string[] role         = Roles.GetRolesForUser(employeeCode);
         string   maxRole      = Commondal.GetMaxRoleForUser(role);
         if (employeeCode != null)
         {
             model.EmployeeID = employeeId;
             model.SearchedUserDetails.EmployeeId   = employeeId;
             model.SearchedUserDetails.EmployeeCode = employeeCode;
             model.SearchedUserDetails.UserRole     = maxRole;
             ViewBag.UserRole = maxRole;
         }
         return(View(model));
     }
     catch (Exception)
     {
         return(RedirectToAction("Index", "Error", new { errorCode = "You are not authorised to do this action" }));
     }
 }
Exemple #23
0
        public void Test_GetEmployee_DAL()
        {
            //Arrange
            var empData = new List <EmployeeDetail>
            {
                new EmployeeDetail()
                {
                    Name       = "Sanjay Kumar",
                    EmployeeID = "M100",
                }
            }.AsQueryable();
            var mockSet = new Mock <DbSet <EmployeeDetail> >();

            mockSet.As <IQueryable <EmployeeDetail> >().Setup(m => m.Provider).Returns(empData.Provider);
            mockSet.As <IQueryable <EmployeeDetail> >().Setup(m => m.Expression).Returns(empData.Expression);
            mockSet.As <IQueryable <EmployeeDetail> >().Setup(m => m.ElementType).Returns(empData.ElementType);
            mockSet.As <IQueryable <EmployeeDetail> >().Setup(m => m.GetEnumerator()).Returns(empData.GetEnumerator());

            var mockContext = new Mock <API201Entities>();

            mockContext.Setup(c => c.EmployeeDetails).Returns(mockSet.Object);

            var service = new EmployeeDAL(mockContext.Object);
            var emp     = service.GetEmployee("M100");

            Assert.AreEqual(empData.Count(), emp.Count());
        }
        public ActionResult Edit(EmployeeModel model)
        {
            EmployeeDAL dal = new EmployeeDAL();

            dal.Update(model.employeeid, model.password, model.employeeemail);
            return(View("view_updated"));
        }
Exemple #25
0
        public string GetCurrentUserLoggedOn()
        {
            EmployeeDAL          empdal          = new EmployeeDAL();
            HRMS_tbl_PM_Employee employeeDetails = empdal.GetEmployeeDetailsFromEmpCode(Convert.ToInt32(Membership.GetUser().UserName));

            return(employeeDetails.EmployeeName);
        }
        public ActionResult search(string key)
        {
            EmployeeDAL dal = new EmployeeDAL();
            List <EmployeeProjectionModel> list = dal.Search(key);

            return(View(list));
        }
Exemple #27
0
        /// <summary>
        /// This function is used to delete a row from the database
        /// </summary>
        /// <param name="dtoobj"> This object contains the id of the Employee who's data we wish to delete from the database</param>
        public void delete(EmployeeDTO dtoobj)
        {
            Employeemapper mapperobj = new Employeemapper();
            EmployeeDAL    edalobj   = new EmployeeDAL();

            edalobj.delete(mapperobj.to_modelobj(dtoobj));
        }
Exemple #28
0
        public ActionResult Index()
        {
            try
            {
                Session["SearchEmpFullName"] = null;  // to hide emp search
                Session["SearchEmpCode"]     = null;
                Session["SearchEmpID"]       = null;

                ConfirmationViewModel confirmationmodel = new ConfirmationViewModel();
                string   EmployeeCode = Membership.GetUser().UserName;
                string[] role         = Roles.GetRolesForUser(EmployeeCode);
                confirmationmodel.SearchedUserDetails = new SearchedUserDetails();
                CommonMethodsDAL Commondal = new CommonMethodsDAL();
                confirmationmodel.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role);
                PersonalDetailsDAL personalDAL = new PersonalDetailsDAL();
                confirmationmodel.SearchedUserDetails.EmployeeCode = EmployeeCode;
                EmployeeDAL DAL = new EmployeeDAL();
                confirmationmodel.SearchedUserDetails.EmployeeId = DAL.GetEmployeeID(EmployeeCode);
                return(View(confirmationmodel));
            }
            catch
            {
                throw;
            }
        }
Exemple #29
0
        /// <summary>
        /// This function is used to update a particular entry in the database
        /// </summary>
        public void update(EmployeeDTO dtoobj)
        {
            Employeemapper mapperobj = new Employeemapper();
            EmployeeDAL    eobj      = new EmployeeDAL();

            eobj.update(mapperobj.to_modelobj(dtoobj));
        }
Exemple #30
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            EmployeeInformationDAL EmpInforDAL = new EmployeeInformationDAL();
            RankDAL       rankDAL   = new RankDAL();
            DepartmentDAL departDAL = new DepartmentDAL();

            cmbGender.ItemsSource     = EmpInforDAL.GetNameByCategory("Gender");
            cmbRank.ItemsSource       = rankDAL.ListAll();
            cmbDepartment.ItemsSource = departDAL.ListAll();

            Employee employee = new Employee();

            employee.Birthday          = DateTime.Today;
            employee.ContractStartDate = DateTime.Today;
            employee.ContractEndDate   = DateTime.Today.AddYears(1);
            employee.RankID            = rankDAL.GetRankIDByRankName("Staff");
            //employee.Password = pwdPassword.Password;
            employee.DepartmentID = EditerDptID;
            employee.PaidFreq     = txtPaidFreq.Text;

            if (IsEdited == false)
            {
                gridEdit.DataContext = employee;
            }
            else
            {
                Employee newemployee = new EmployeeDAL().GetByUerName(SelectedUserName);
                gridEdit.DataContext = newemployee;
            }
        }
		public void BareMinimum()
		{
			using (SqlConnection conn = new SqlConnection(@"Server=10.6.0.116\sqlexpress;Database=Tests;User Id=testusr;Password=pass@word1;"))
			{
				EmployeeDAL dal = new EmployeeDAL(new DapperDatabase(conn));
			
				Employee employee = dal[EmployeeDAL.Queries.GET_BY_ID.ToString()].AddParam("1", 1).Db.Get<Employee>();
			}
		}