コード例 #1
0
        private void DiaChiInfoPrepare(DiaChiModel model)
        {
            var states = _stateProvinceService.GetStateProvincesByCountryId(NhaXesController.CountryID);

            if (states.Count > 0)
            {
                foreach (var s in states)
                {
                    model.AvailableStates.Add(new SelectListItem {
                        Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.ProvinceID)
                    });
                }
                int ProvinceID = Convert.ToInt32(model.AvailableStates[0].Value);
                if (model.Id > 0 && model.ProvinceID > 0)
                {
                    ProvinceID = model.ProvinceID.GetValueOrDefault(0);
                }
                var quanhuyens = _diachiService.GetQuanHuyenByProvinceId(ProvinceID);
                model.AvailableQuanHuyens.Add(new SelectListItem {
                    Text = GetLabel("ChonQuanHuyen"), Value = "0", Selected = (model.QuanHuyenID == 0)
                });
                foreach (var s in quanhuyens)
                {
                    model.AvailableQuanHuyens.Add(new SelectListItem {
                        Text = s.Ten, Value = s.Id.ToString(), Selected = (s.Id == model.QuanHuyenID)
                    });
                }
            }
        }
コード例 #2
0
        public DiaChiModel themdiachi(DiaChiModel dc)
        {
            DiaChiModel dcmoi = new DiaChiModel();

            dcmoi = item.ThemDiaChi(dc);
            return(dcmoi);
        }
コード例 #3
0
        public DiaChiModel themdiachi(DiaChiModel dc)
        {
            string msgError = "";

            try
            {
                var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "themdiachi",
                                                                    "@makh", dc.MaKhachHang,
                                                                    "@xa", dc.Xa,
                                                                    "@huyen", dc.Huyen,
                                                                    "@tinh", dc.Tinh,
                                                                    "@chitiet", dc.ChiTiet,
                                                                    "@sdt", dc.SoDienThoai);
                if (!string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(msgError);
                }
                return(dt.ConvertTo <DiaChiModel>().FirstOrDefault());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
 public DiaChiModel ThemDiaChi(DiaChiModel dc)
 {
     return(_res.themdiachi(dc));
 }
コード例 #5
0
 public static DiaChi ToEntity(this DiaChiModel model, DiaChi destination)
 {
     return(model.MapTo(destination));
 }
コード例 #6
0
 public static DiaChi ToEntity(this DiaChiModel model)
 {
     return(model.MapTo <DiaChiModel, DiaChi>());
 }
コード例 #7
0
 public BenXeModel()
 {
     ThongTinDiaChi = new DiaChiModel();
     HienThi        = true;
 }