public ActionResult Modify(Student Stdnt)
        {
            try
            {
                string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
                using (IDbConnection db = new SqlConnection(_connectionString))
                {
                    CustomerPageVM pageVM = new CustomerPageVM();
                    var            query  = "ModifyById";
                    var            param  = new DynamicParameters();
                    param.Add("id", Stdnt.Id);
                    param.Add("firstName", Stdnt.FirstName);
                    param.Add("midName", Stdnt.MidName);
                    param.Add("lastName", Stdnt.LastName);
                    param.Add("genderId", Stdnt.GenderId);
                    param.Add("email", Stdnt.Email);
                    param.Add("address", Stdnt.Address);
                    param.Add("quillContent", Stdnt.QuillContent);
                    param.Add("bloodId", Stdnt.BloodId);
                    db.Query <Student>(query, param, commandType: CommandType.StoredProcedure);

                    query = "GetStudentById";
                    var param1 = new DynamicParameters();
                    param1.Add("Id", Stdnt.Id);
                    var list = db.Query <Student>(query, param1, commandType: CommandType.StoredProcedure).First();
                    return(Redirect("/CmsAdmin/AdminCms/"));
                    //return View(list);
                }
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }
示例#2
0
        // GET: Admin/Customers
        public async Task <IActionResult> Index(string keyword, int?page)
        {
            CustomerPageVM vm = new CustomerPageVM()
            {
                PageIndex = page == null || page <= 0 ? 1 : page.Value,
                Keyword   = keyword
            };
            var pageSize = 10;

            var query = _context.Customers.AsNoTracking().AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(d => d.Mobile.Contains(keyword));
            }



            vm.TotalCount = await query.CountAsync();

            var list = await query.Skip((vm.PageIndex - 1) *pageSize).Take(pageSize).ProjectTo <CustomerVM>(_mapper.ConfigurationProvider).ToListAsync();

            //   var list = _mapper.Map<IEnumerable<CustomerVM>>(agents);

            vm.Customers = new StaticPagedList <CustomerVM>(list, vm.PageIndex, pageSize, vm.TotalCount);



            return(View(vm));
        }
 public ActionResult create(Student Instd)
 {
     try
     {
         string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
         using (IDbConnection db = new SqlConnection(_connectionString))
         {
             CustomerPageVM pageVM = new CustomerPageVM();
             var            query  = "InsertStudent";
             var            param  = new DynamicParameters();
             param.Add("id", Instd.Id);
             param.Add("firstName", Instd.FirstName);
             param.Add("midName", Instd.MidName);
             param.Add("lastName", Instd.LastName);
             param.Add("genderId", Instd.GenderId);
             param.Add("email", Instd.Email);
             param.Add("address", Instd.Address);
             param.Add("quillContent", Instd.QuillContent);
             param.Add("bloodId", Instd.BloodId);
             db.Query <Student>(query, param, commandType: CommandType.StoredProcedure);
             return(Redirect("/CmsAdmin/AdminCms/"));
         }
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
 public ActionResult VueIndex()
 {
     try
     {
         string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
         using (IDbConnection db = new SqlConnection(_connectionString))
         {
             CustomerPageVM pageVM = new CustomerPageVM();
             var            query  = "GetAllStudent";
             pageVM.OurCustomers = db.Query <Student>(query, commandType: CommandType.StoredProcedure);
             return(new ViewAsPdf(pageVM));
         }
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
示例#5
0
        public CustomerPageUI()
        {
            InitializeComponent();
            BindingContext = new CustomerPageVM(Navigation);

            client = new FireSharp.FirebaseClient(config.config);

            CMND.Text = UserData.shared.IDCard;

            CMND_        = CMND.Text;
            dantoc.Text  = _dantoc;
            tongiao.Text = _tongiao;
            addpickerhocvan();
            addgioitinh();
            addloaixe();
            getkhachthue();

            this.handleEvent();
        }
 public ActionResult details(int id)
 {
     try
     {
         string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
         using (IDbConnection db = new SqlConnection(_connectionString))
         {
             CustomerPageVM pageVM = new CustomerPageVM();
             var            query  = "GetStudentById";
             var            param  = new DynamicParameters();
             param.Add("id", id);
             var list = db.Query <Student>(query, param, commandType: CommandType.StoredProcedure).First();
             return(View(list));
         }
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
 public ActionResult delete(int id)
 {
     try
     {
         string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
         using (IDbConnection db = new SqlConnection(_connectionString))
         {
             CustomerPageVM pageVM = new CustomerPageVM();
             var            query  = "DeleteStudentWithId";
             var            param  = new DynamicParameters();
             param.Add("id", id);
             db.Query <Student>(query, param, commandType: CommandType.StoredProcedure);
             return(Redirect("/CmsAdmin/AdminCms/"));
         }
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
 // GET: CmsAdmin/AdminCms
 public ActionResult Index()
 {
     try
     {
         string _connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString as string;
         using (IDbConnection db = new SqlConnection(_connectionString))
         {
             CustomerPageVM pageVM = new CustomerPageVM();
             var            query  = "GetAllStudent";
             pageVM.OurCustomers = db.Query <Student>(query, commandType: CommandType.StoredProcedure);
             HttpCookie cookie = new HttpCookie("TestCookie");
             cookie.Value = "This is test cookie";
             this.ControllerContext.HttpContext.Response.Cookies.Add(cookie);
             return(View(pageVM));
         }
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
示例#9
0
 public async Task OnGet(string searchString, int pageIndex = 1)
 {
     ListCustomerPage = await _serviceVM.GetCustomerPageViewModelAsync(SearchString, pageIndex);
 }
示例#10
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            var vm = BindingContext as CustomerPageVM;

            if (vm.Items.Count <= 0)
            {
                BindingContext = new CustomerPageVM(Navigation);
            }
            SiteCurentLabelNavigatePage.Text      = this._customerInforPlaceholder_CurentSite;
            HometownLabelNavigatePage.Text        = this._customerInforPlaceholder_Hometown;
            PlaceJobLabelNavigatePage.Text        = this._customerInforPlaceholder_JobSite;
            AddressResidentLabelNavigatePage.Text = this._customerInforPlaceholder_Resident;


            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforCurrentSite))
            {
                SiteCurentLabelNavigatePage.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCurrentSite].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforHometown))
            {
                HometownLabelNavigatePage.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforHometown].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforJobSite))
            {
                PlaceJobLabelNavigatePage.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforJobSite].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforResidentSite))
            {
                AddressResidentLabelNavigatePage.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforResidentSite].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforName))
            {
                TENKH.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforName] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforName].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforCMNDCreateDate))
            {
                ngaycap.Date = Convert.ToDateTime(Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCMNDCreateDate]);
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforBirthday))
            {
                ngaysinh.Date = Convert.ToDateTime(Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforBirthday]);
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforSex))
            {
                //gioitinh_.SelectedItem = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforSex];
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforPhone))
            {
                dienthoai.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforPhone] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforPhone].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforDanToc))
            {
                dantoc.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforDanToc] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforDanToc].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforTonGiao))
            {
                tongiao.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforTonGiao] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforTonGiao].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforJob))
            {
                nghenghiep.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforJob] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforJob].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforCompany))
            {
                Congty.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCompany] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCompany].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforEmail))
            {
                mail.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforEmail] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforEmail].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforCartMoto))
            {
                bienso.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCartMoto] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCartMoto].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforTypeMoto))
            {
                //bienso.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforCartMoto].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforEdu))
            {
                //bienso.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforEdu].ToString();
            }
            if (Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.CustomerInforProfection))
            {
                Chuyenmon.Text = Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforProfection] == null ? "" : Application.Current.Properties[KeyCustomerViewEnumeration.CustomerInforProfection].ToString();
            }
        }