Exemple #1
0
        public JsonResult Search(Search_Model input)
        {
            Get_Post_List model = new Get_Post_List();

            Services.Post_Service services = new Services.Post_Service();
            model = services.SearchService(input.searchStr);
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
 //Constructor in order to search an adult
 public Search_ViewModel(SearchAdult_UserCntrl mySearchAdult_UserCntrlV, LogIn_AdministratorViewModel logIn_AdministratorViewModel)
 {
     search_CMD             = new Search_Command(this);
     search_Update_CMD      = new Search_Update_Command(this);
     search_M               = new Search_Model();
     adults                 = new List <Adult>();
     SearchAdult_UserCntrlV = mySearchAdult_UserCntrlV;
     LogIn_AdministratorVM  = logIn_AdministratorViewModel;
 }
 //Constructors
 //Constructor in order to search a delivery man
 public Search_ViewModel(SearchDeliverMan_UserCntrl mySearchDeliverMan_UserCntrlV, LogIn_AdministratorViewModel logIn_AdministratorViewModel)
 {
     search_CMD                  = new Search_Command(this);
     search_Update_CMD           = new Search_Update_Command(this);
     search_M                    = new Search_Model();
     delivermen                  = new List <DeliveryMan>();
     SearchDeliverMan_UserCntrlV = mySearchDeliverMan_UserCntrlV;
     LogIn_AdministratorVM       = logIn_AdministratorViewModel;
 }
        private void Set_DBVIew(Search_Model search_Model)
        {
            txtSKU.Text                    = search_Model.SKU.ToString();
            txtRegisterNumber.Text         = search_Model.RegisterNumber.ToString();
            txtName.Text                   = search_Model.FullName.ToString();
            txtNation.Text                 = search_Model.Nation.ToString();
            txtAddress.Text                = search_Model.Address.ToString();
            txtPhone.Text                  = search_Model.PhoneNumber.ToString();
            dtpBirthday.Text               = search_Model.Day_of_Birth.ToString();
            dtpRegisterDay.Text            = search_Model.Day_Create.ToString();
            txtBirthplace.Text             = search_Model.Place_of_birth.ToString();
            cboRegisterClass.Text          = search_Model.Class_Name.ToString();
            cboRegisterClass.SelectedValue = search_Model.class_ID;

            arrImage = search_Model.Image;
            SettingImage_BLO settingImage_BLO = new SettingImage_BLO();

            try
            {
                ImageBrush image = new ImageBrush();
                image.ImageSource = settingImage_BLO.ConvertByte_ToImage(arrImage);
                if (image == null)
                {
                    return;                 // Case: Open Dialog but not choose image
                }
                ImageButton.Background = image;
            }
            catch { MessageBox.Show("Ảnh không hợp lệ", "Lỗi"); }

            dtpLevel6.Text = search_Model.DAI_Cap_6.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_6.ToString();
            dtpLevel5.Text = search_Model.DAI_Cap_5.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_5.ToString();
            dtpLevel4.Text = search_Model.DAI_Cap_4.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_4.ToString();
            dtpLevel3.Text = search_Model.DAI_Cap_3.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_3.ToString();
            dtpLevel2.Text = search_Model.DAI_Cap_2.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_2.ToString();
            dtpLevel1.Text = search_Model.DAI_Cap_1.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAI_Cap_1.ToString();

            dtpDanVN1.Text = search_Model.DAN_VN_1.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_1.ToString();
            dtpDanVN2.Text = search_Model.DAN_VN_2.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_2.ToString();
            dtpDanVN3.Text = search_Model.DAN_VN_3.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_3.ToString();
            dtpDanVN4.Text = search_Model.DAN_VN_4.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_4.ToString();
            dtpDanVN5.Text = search_Model.DAN_VN_5.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_5.ToString();
            dtpDanVN6.Text = search_Model.DAN_VN_6.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_6.ToString();
            dtpDanVN7.Text = search_Model.DAN_VN_7.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_7.ToString();
            dtpDanVN8.Text = search_Model.DAN_VN_8.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_VN_8.ToString();


            dtpDanAIKIKAI1.Text = search_Model.DAN_AIKIKAI_1.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_1.ToString();
            dtpDanAIKIKAI2.Text = search_Model.DAN_AIKIKAI_2.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_2.ToString();
            dtpDanAIKIKAI3.Text = search_Model.DAN_AIKIKAI_3.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_3.ToString();
            dtpDanAIKIKAI4.Text = search_Model.DAN_AIKIKAI_4.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_4.ToString();
            dtpDanAIKIKAI5.Text = search_Model.DAN_AIKIKAI_5.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_5.ToString();
            dtpDanAIKIKAI6.Text = search_Model.DAN_AIKIKAI_6.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_6.ToString();
            dtpDanAIKIKAI7.Text = search_Model.DAN_AIKIKAI_7.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_7.ToString();
            dtpDanAIKIKAI8.Text = search_Model.DAN_AIKIKAI_8.ToString().Contains(DateTime.MinValue.ToString()) == true ? " " : search_Model.DAN_AIKIKAI_8.ToString();
            changevalue         = false;
        }
        public RegisterMemberScreen(Search_Model search_Model)
        {
            InitializeComponent();
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "dd/MM/yyyy";
            Thread.CurrentThread.CurrentCulture = ci;


            List <Class> showCombobox = ClassDB.ComboxClass2(true);

            cboRegisterClass.ItemsSource       = showCombobox;
            cboRegisterClass.DisplayMemberPath = "Class_Name";
            cboRegisterClass.SelectedValuePath = "ID_Class";

            Set_DBVIew(search_Model);
            changevalue = false;
        }
        //lấy dữ liệu
        public List <Search_Model> GetStudent()
        {
            using (var dbContext = new AccessDB_DAO())
            {
                List <Search_Model> datas = new List <Search_Model>();
                try
                {
                    var query = dbContext.Fees.GroupBy(c => new { c.RegisterNumber, c.ID_Class }).Select(g => g.First());  //Minh modified 4/8/2018
                    foreach (var i in query)
                    {
                        var          MemberInfo = dbContext.Students.Single(c => c.RegisterNumber == i.RegisterNumber);
                        var          ClassInfo  = dbContext.Classes.Single(l => l.ID_Class == i.ID_Class);
                        Search_Model data       = new Search_Model();
                        data.RegisterNumber = i.RegisterNumber;
                        data.SKU            = MemberInfo.SKU;
                        data.FullName       = MemberInfo.FullName;
                        data.Nation         = MemberInfo.Nation;
                        data.Address        = MemberInfo.Address;
                        data.PhoneNumber    = MemberInfo.PhoneNumber;
                        data.Day_of_Birth   = MemberInfo.Day_of_Birth.Date;
                        data.Place_of_birth = MemberInfo.Place_of_Birth;
                        data.Day_Create     = MemberInfo.Day_Create.Date;
                        data.class_ID       = ClassInfo.ID_Class;
                        data.Class_Name     = ClassInfo.Class_Name;
                        data.Image          = MemberInfo.Image;

                        //Lấy Mã DAI DAN
                        foreach (var dd in dbContext.Provide_Dai_Dans.Where(s => s.RegisterNumber == i.RegisterNumber))
                        {
                            var na = dbContext.Dai_Dans.Where(s => s.ID == dd.ID_DAI_DAN).First();
                            if (na.Name.Equals("Cap6"))
                            {
                                data.DAI_Cap_6 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("Cap5"))
                            {
                                data.DAI_Cap_5 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("Cap4"))
                            {
                                data.DAI_Cap_4 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("Cap3"))
                            {
                                data.DAI_Cap_3 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("Cap2"))
                            {
                                data.DAI_Cap_2 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("Cap1"))
                            {
                                data.DAI_Cap_1 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN1"))
                            {
                                data.DAN_VN_1 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN2"))
                            {
                                data.DAN_VN_2 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN3"))
                            {
                                data.DAN_VN_3 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN4"))
                            {
                                data.DAN_VN_4 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN5"))
                            {
                                data.DAN_VN_5 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN6"))
                            {
                                data.DAN_VN_6 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN7"))
                            {
                                data.DAN_VN_7 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANVN8"))
                            {
                                data.DAN_VN_8 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI1"))
                            {
                                data.DAN_AIKIKAI_1 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI2"))
                            {
                                data.DAN_AIKIKAI_2 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI3"))
                            {
                                data.DAN_AIKIKAI_3 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI4"))
                            {
                                data.DAN_AIKIKAI_4 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI5"))
                            {
                                data.DAN_AIKIKAI_5 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI6"))
                            {
                                data.DAN_AIKIKAI_6 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI7"))
                            {
                                data.DAN_AIKIKAI_7 = dd.Day_Provide;
                            }
                            if (na.Name.Equals("DANAIKIKAI8"))
                            {
                                data.DAN_AIKIKAI_8 = dd.Day_Provide;
                            }
                        }

                        datas.Add(data);
                    }
                }
                catch
                {
                }
                return(datas);
            }
        }