Exemplo n.º 1
0
 private void btn_Category_Reset_Click(object sender, RoutedEventArgs e)
 {
     textBox_Category_ID.Text = Category_BL.GetAutogeneratedCategoryID_BL().ToString();
     textBox_SearchCategory.Clear();
     textBox_Category_Name.Clear();
     textBox_Category_Description.Clear();
 }
Exemplo n.º 2
0
        private void btn_Category_Search_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int       catId = Convert.ToInt32(textBox_SearchCategory.Text);
                DataTable sEd   = Category_BL.SearchCategoryById_BL(catId);

                DataRow dr = sEd.Rows[0];
                if (!dr.IsNull("Category_Id"))
                {
                    textBox_Category_ID.Text          = dr["Category_Id"].ToString();
                    textBox_Category_Name.Text        = dr["Category_Name"].ToString();
                    textBox_Category_Description.Text = dr["Category_Description"].ToString();
                }
                else
                {
                    MessageBox.Show("No Records found with Category Id : " + catId);
                }
            }
            catch (HRMSException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void btn_Category_Delete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int catId = Convert.ToInt32(textBox_SearchCategory.Text);

                int rowsAffected = Category_BL.DeleteCategory_BL(catId);
                if (rowsAffected > 0)
                {
                    MessageBox.Show("Category Details Deleted !!");
                }
                else
                {
                    MessageBox.Show("Error!!! Category Record not found");
                }
            }
            catch (HRMSException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void btn_Category_Update_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Category newCat = new Category();

                newCat.CategoryId          = Convert.ToInt32(textBox_Category_ID.Text);
                newCat.CategoryName        = textBox_Category_Name.Text;
                newCat.CategoryDescription = textBox_Category_Description.Text;

                int rowsAffected = Category_BL.UpdateCategory_BL(newCat);
                if (rowsAffected > 0)
                {
                    MessageBox.Show("Category Updated !!");
                }
                else
                {
                    MessageBox.Show("Error!!! Category Record not Updated");
                }
            }
            catch (HRMSException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        //
        // GET: /ModuleProduct/Category/

        public ActionResult CategorysList()
        {
            try
            {
                string _url = Request.RawUrl;
                string _ok  = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url);
                if (_ok != "")
                {
                    return(Redirect(_ok));
                }
                int    fromRow    = 0;
                string htmlPaging = "";

                Category_BL            _Category_BL = new Category_BL();
                List <Categories_Info> _lst_data    = _Category_BL.Category_GetAll();

                List <Categories_Info> lstDataBreakPage = NaviCommon.CommonFuc.GetPaging <Categories_Info>(_lst_data, 1, ref fromRow, ref htmlPaging, "Loại sản phẩm");
                ViewBag.Paging    = htmlPaging;
                ViewBag.FromRow   = fromRow;
                ViewBag.Obj       = lstDataBreakPage;
                ViewBag.SumRecord = _lst_data.Count;

                return(View());
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());

                ViewBag.FromRow = 0;
                return(View(new List <Categories_Info>()));
            }
        }
Exemplo n.º 6
0
        public string M_Category_ExistsCheck([FromBody] CategoryModel cmodel)
        {
            if (cmodel == null)
            {
                cmodel = new CategoryModel();
            }
            Category_BL Cbl = new Category_BL();

            return(Cbl.M_Category_ExistsCheck(cmodel));
        }
Exemplo n.º 7
0
 public ActionResult ShowViewCategory(decimal p_id)
 {
     try
     {
         Category_BL     _Category_BL     = new Category_BL();
         Categories_Info _Categories_Info = _Category_BL.Category_GetById(p_id);
         ViewBag.obj = _Categories_Info;
         return(PartialView("~/Areas/ModuleProduct/Views/Category/P_View_Category.cshtml"));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(PartialView("P_View_Category"));
     }
 }
Exemplo n.º 8
0
        public ActionResult ShowInsertProduct()
        {
            try
            {
                Category_BL            _Category_BL = new Category_BL();
                List <Categories_Info> _lst         = _Category_BL.Category_GetAll();
                ViewBag.LstCategory = _lst;

                return(PartialView("~/Areas/ModuleProduct/Views/Product/_Partial_Insert_Product.cshtml"));
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(null);
            }
        }
Exemplo n.º 9
0
 private void btn_Category_Display_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable dtCat = Category_BL.DisplayCategory_BL();
         dg_Category_Details.ItemsSource = dtCat.DefaultView;
     }
     catch (HRMSException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 10
0
        public ActionResult DeleteCategory(decimal p_category_id)
        {
            try
            {
                // Kiểm tra có phiên làm việc không
                var objUser = SessionData.CurrentUser as User_Info;
                if (objUser == null)
                {
                    // thoát đăng nhập
                    return(Json(new { success = -1 }));
                }

                Category_BL _Category_BL = new Category_BL();

                decimal _kq = _Category_BL.Category_Delete(p_category_id);
                return(Json(new { success = _kq }));
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(Json(new { success = -1 }));
            }
        }
Exemplo n.º 11
0
        public ActionResult SearchCategory(string p_name)
        {
            try
            {
                int    fromRow    = 0;
                string htmlPaging = "";

                Category_BL            _Category_BL = new Category_BL();
                List <Categories_Info> _lst_data    = _Category_BL.Category_Search(p_name);

                List <Categories_Info> lstDataBreakPage = NaviCommon.CommonFuc.GetPaging <Categories_Info>(_lst_data, 1, ref fromRow, ref htmlPaging, "Loại sản phẩm");
                ViewBag.Paging    = htmlPaging;
                ViewBag.FromRow   = fromRow;
                ViewBag.Obj       = lstDataBreakPage;
                ViewBag.SumRecord = _lst_data.Count;

                return(PartialView("PartialViewTableslistCategory"));
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(PartialView("PartialViewTableslistCategory"));
            }
        }
Exemplo n.º 12
0
        public ActionResult Category_Insert(string p_Category_code, string p_Category_name, string p_unit)
        {
            try
            {
                // Kiểm tra có phiên làm việc không
                var objUser = SessionData.CurrentUser as User_Info;
                if (objUser == null)
                {
                    // thoát đăng nhập
                    return(Json(new { success = -1 }));
                }

                Category_BL _Category_BL = new Category_BL();
                if (_Category_BL.Category_GetByCode(p_Category_code) != null)
                {
                    return(Json(new { success = -2 }));
                }
                else
                {
                    bool _kq = _Category_BL.Category_Insert(p_Category_code, p_Category_name, p_unit);
                    if (_kq)
                    {
                        return(Json(new { success = 0 }));
                    }
                    else
                    {
                        return(Json(new { success = -1 }));
                    }
                }
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(Json(new { success = -1 }));
            }
        }
Exemplo n.º 13
0
        public string Get_CategoryType([FromBody] CategoryModel Cmodel)
        {
            Category_BL Cbl = new Category_BL();

            return(Cbl.Get_CategoryType(Cmodel));
        }
Exemplo n.º 14
0
        public string Category_CUD([FromBody] CategoryModel bmodel)
        {
            Category_BL Cbl = new Category_BL();

            return(Cbl.Category_CUD(bmodel));
        }
Exemplo n.º 15
0
        public string M_Category_Select([FromBody] CategoryModel Cmodel)
        {
            Category_BL Cbl = new Category_BL();

            return(Cbl.M_Category_Select(Cmodel));
        }
Exemplo n.º 16
0
        //OnLoad Event
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            textBox_Employee_Id.Text = EmployeeValidation.GetAutogeneratedEmployeeID_BL().ToString();
            textBox_Project_ID.Text  = Project_BL.GetAutogeneratedProjectID_BL().ToString();
            textBox_Category_ID.Text = Category_BL.GetAutogeneratedCategoryID_BL().ToString();
            textBox_Skill_ID.Text    = Skill_BL.GetAutogeneratedSkillID_BL().ToString();
            //Load Civil Status Data from Database
            DataTable dtCivil = EmployeeValidation.LoadCivilStatus_BL();

            if (dtCivil.Rows.Count >= 0)
            {
                cmb_Employee_CivilStatus.ItemsSource = dtCivil.DefaultView;

                cmb_Employee_CivilStatus.DisplayMemberPath = "Status_Description";
                cmb_Employee_CivilStatus.SelectedValuePath = "Status_Id";
            }

            //Load Level Data from Database
            DataTable dtLvl = EmployeeValidation.LoadLevel_BL();

            if (dtLvl.Rows.Count >= 0)
            {
                cmb_Employee_LevelID.ItemsSource = dtLvl.DefaultView;

                cmb_Employee_LevelID.DisplayMemberPath = "Level_Description";
                cmb_Employee_LevelID.SelectedValuePath = "Level_Id";
            }

            //Load Projects Data from Database
            DataTable dtProj = EmployeeValidation.LoadProject_BL();

            if (dtProj.Rows.Count >= 0)
            {
                cmb_Employee_ProjectID.ItemsSource = dtProj.DefaultView;

                cmb_Employee_ProjectID.DisplayMemberPath = "Project_Name";
                cmb_Employee_ProjectID.SelectedValuePath = "Project_Id";
            }

            //Load Speciality Data from Database
            DataTable dtSpec = EmployeeValidation.LoadSeciality_BL();

            if (dtSpec.Rows.Count >= 0)
            {
                cmb_Employee_Speciality.ItemsSource = dtSpec.DefaultView;

                cmb_Employee_Speciality.DisplayMemberPath = "Speciality_Name";
                cmb_Employee_Speciality.SelectedValuePath = "Speciality_Id";
            }

            //Load Skills Data from Database
            DataTable dtSkill = EmployeeValidation.LoadSkill_BL();

            if (dtSkill.Rows.Count >= 0)
            {
                cmb_Employee_SkillID.ItemsSource = dtSkill.DefaultView;

                cmb_Employee_SkillID.DisplayMemberPath = "Skill_Name";
                cmb_Employee_SkillID.SelectedValuePath = "Skill_Id";
            }

            //Load Category Data from Database
            DataTable dtCat = Skill_BL.LoadCatSkill_BL();

            if (dtCat.Rows.Count >= 0)
            {
                cmb_Category_ID.ItemsSource = dtCat.DefaultView;

                cmb_Category_ID.DisplayMemberPath = "Category_Name";
                cmb_Category_ID.SelectedValuePath = "Category_Id";
            }
        }