Exemplo n.º 1
0
        public ActionResult NewEmployee(string button, Models.DepartmentModels ReadDepartmentModel, string NewEmployeeName, string NewCompanyEmployeeCode)
        {
            Models.DepartmentModels    DepartmentModel = new Models.DepartmentModels();
            List <Models.M_Department> DepartmentList  = new List <Models.M_Department>();


            DepartmentModel.checkCodeflag  = true;
            DepartmentModel.checkInputflag = true;

            if (button == "Register")
            {
                if (ReadDepartmentModel.SelectDepartmentId != 0 && NewEmployeeName != "" && NewCompanyEmployeeCode != "")
                {
                    DepartmentModel.checkCodeflag = checkCompanyEmployeeCode(NewCompanyEmployeeCode);
                    if (DepartmentModel.checkCodeflag == true)
                    {
                        int RegisterId = GetRegisterNumber() + 1;
                        RegisterEmployee(RegisterId, ReadDepartmentModel.SelectDepartmentId, NewEmployeeName, NewCompanyEmployeeCode);
                        return(RedirectToAction("Index", "Department"));
                    }
                }
                else
                {
                    DepartmentModel.checkInputflag = false;
                }
            }

            DepartmentList = GetDepartmentList(DepartmentModel);
            return(View(DepartmentModel));
        }
Exemplo n.º 2
0
        // GET: Registros
        public ActionResult addDepartment()
        {
            Muebleria18.Models.DepartmentModels pModel = new Models.DepartmentModels();
            pModel.mensaje            = "Bienvenido a mi ABM";
            pModel.lstDepartmentModel = Dominio.Fachada.Department_SearchAll();

            return(View(pModel));
        }
Exemplo n.º 3
0
        // GET: Department
        public ActionResult Index(string button, Models.DepartmentModels ReadDepartmentModel, string SearchEmployeeName)
        {
            Models.DepartmentModels    DepartmentModel = new Models.DepartmentModels();
            List <Models.M_Department> DepartmentList  = new List <Models.M_Department>();

            DepartmentList = GetDepartmentList(DepartmentModel);

            if (button == "Search")
            {
                DepartmentModel.SearchResult = SearchResult(ReadDepartmentModel.SelectDepartmentId, SearchEmployeeName);
            }
            return(View(DepartmentModel));
        }
Exemplo n.º 4
0
        public List <Models.M_Department> GetDepartmentList(Models.DepartmentModels DepartmentModel)
        {
            Modules.DBModules          DB             = new Modules.DBModules();
            Models.M_Department        Department     = new Models.M_Department();
            List <Models.M_Department> DepartmentList = new List <Models.M_Department>();
            SqlDataReader sqlRdr = null;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM M_Department");
            try
            {
                if (!DB.DB_Connect())
                {
                }
                if (DB.DB_SqlReader(strSql.ToString(), ref sqlRdr))
                {
                }
                while (sqlRdr.Read())
                {
                    Department = new Models.M_Department();

                    Department.DepartmentId   = int.Parse(sqlRdr["DepartmentId"].ToString());
                    Department.DepartmentName = sqlRdr["DepartmentName"].ToString();

                    DepartmentList.Add(Department);
                }
                DepartmentModel.DepartmentList = DepartmentList;
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (sqlRdr != null)
                {
                    if (!sqlRdr.IsClosed)
                    {
                        sqlRdr.Close();
                    }
                }
                DB.DB_Close();
            }
            return(DepartmentList);
        }