コード例 #1
0
 public MdSupplier SyncSQLToOracle(TDS_Dmkhachhang instance)
 {
     using (var ctx = new DBCSQL())
     {
         var config = new MapperConfiguration(cfg =>
         {
             cfg.CreateMap <TDS_Dmkhachhang, MdSupplier>()
             .ForMember(dest => dest.MaNCC, opt => opt.MapFrom(u => u.Makhachhang))
             .ForMember(dest => dest.TenNCC, opt => opt.MapFrom(u => u.Tenkhachhang))
             .ForMember(dest => dest.DiaChi, opt => opt.MapFrom(u => u.Diachi))
             .ForMember(dest => dest.DienThoai, opt => opt.MapFrom(u => u.Dienthoai))
             .ForMember(dest => dest.Fax, opt => opt.MapFrom(u => u.Fax))
             .ForMember(dest => dest.Email, opt => opt.MapFrom(u => u.Email))
             .ForMember(dest => dest.TrangThai, opt => opt.UseValue(10))
             .ForMember(dest => dest.IState, opt => opt.UseValue(10));
         });
         try
         {
             var mapper   = config.CreateMapper();
             var customer = mapper.Map <TDS_Dmkhachhang, MdSupplier>(instance);
             customer.ICreateBy   = GetClaimsPrincipal().Identity.Name;
             customer.ICreateDate = DateTime.Now;
             var result = Insert(customer);
             return(result);
         }
         catch
         {
             return(null);
         }
     }
 }
コード例 #2
0
ファイル: MdCustomerVm.cs プロジェクト: gosusama/DBC
            public List <IQueryFilter> GetFilters()
            {
                var result = new List <IQueryFilter>();
                var refObj = new TDS_Dmkhachhang();

                if (!string.IsNullOrEmpty(this.Makhachhang))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Makhachhang),
                        Value    = this.Makhachhang,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Tenkhachhang))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Tenkhachhang),
                        Value    = this.Tenkhachhang,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Diachi))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Diachi),
                        Value    = this.Diachi,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Dienthoai))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Dienthoai),
                        Value    = this.Dienthoai,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Fax))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Fax),
                        Value    = this.Fax,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Email))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Email),
                        Value    = this.Email,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.Masothue))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.Masothue),
                        Value    = this.Masothue,
                        Method   = FilterMethod.Like
                    });
                }

                return(result);
            }