public async Task <GarmentSupplierViewModel> GetNewData2() { string guid = Guid.NewGuid().ToString(); GarmentSupplierViewModel TestData = new GarmentSupplierViewModel { name = guid, code = guid, usevat = true, import = false, usetax = true, NPWP = guid, serialNumber = guid, PIC = guid, address = guid, contact = guid, IncomeTaxes = new IncomeTaxViewModel { Id = 2, name = guid, rate = 0 }, }; return(TestData); }
public GarmentSupplierViewModel MapToViewModel(GarmentSupplier GarmentSupplier) { GarmentSupplierViewModel GarmentSupplierVM = new GarmentSupplierViewModel(); GarmentSupplierVM.Id = GarmentSupplier.Id; GarmentSupplierVM.UId = GarmentSupplier.UId; GarmentSupplierVM._IsDeleted = GarmentSupplier._IsDeleted; GarmentSupplierVM.Active = GarmentSupplier.Active; GarmentSupplierVM._CreatedUtc = GarmentSupplier._CreatedUtc; GarmentSupplierVM._CreatedBy = GarmentSupplier._CreatedBy; GarmentSupplierVM._CreatedAgent = GarmentSupplier._CreatedAgent; GarmentSupplierVM._LastModifiedUtc = GarmentSupplier._LastModifiedUtc; GarmentSupplierVM._LastModifiedBy = GarmentSupplier._LastModifiedBy; GarmentSupplierVM._LastModifiedAgent = GarmentSupplier._LastModifiedAgent; GarmentSupplierVM.code = GarmentSupplier.Code; GarmentSupplierVM.name = GarmentSupplier.Name; GarmentSupplierVM.address = GarmentSupplier.Address; GarmentSupplierVM.contact = GarmentSupplier.Contact; GarmentSupplierVM.PIC = GarmentSupplier.PIC; GarmentSupplierVM.import = GarmentSupplier.Import; GarmentSupplierVM.usevat = GarmentSupplier.UseVat; GarmentSupplierVM.usetax = GarmentSupplier.UseTax; GarmentSupplierVM.IncomeTaxes = new IncomeTaxViewModel { Id = GarmentSupplier.IncomeTaxesId, name = GarmentSupplier.IncomeTaxesName, rate = GarmentSupplier.IncomeTaxesRate }; GarmentSupplierVM.NPWP = GarmentSupplier.NPWP; GarmentSupplierVM.serialNumber = GarmentSupplier.SerialNumber; return(GarmentSupplierVM); }
public void Should_Success_Upload_CSV_Data_when_UseTax_False() { GarmentSupplierViewModel Vmodel4 = DataUtil.GetNewData4(); var Response = Services.UploadValidate(new List <GarmentSupplierViewModel> { Vmodel4 }, null); Assert.Equal(Response.Item1, true); }
public void Should_Error_Upload_CSV_Data_when_UseTax_False() { GarmentSupplierViewModel Vmodel5 = DataUtil.GetNewData5(); GarmentSupplierViewModel Vmodel6 = DataUtil.GetNewData6(); GarmentSupplierViewModel Vmodel7 = DataUtil.GetNewData7(); var Response = Services.UploadValidate(new List <GarmentSupplierViewModel> { Vmodel5, Vmodel6, Vmodel7 }, null); Assert.Equal(Response.Item1, false); }
public void Should_Error_Upload_CSV_Data_with_false_IncomeTax() { GarmentSupplierViewModel Vmodel1 = DataUtil.GetNewData1(); GarmentSupplierViewModel Vmodel2 = DataUtil.GetNewData2(); GarmentSupplierViewModel Vmodel3 = DataUtil.GetNewData3(); var Response = Services.UploadValidate(new List <GarmentSupplierViewModel> { Vmodel1, Vmodel2, Vmodel3 }, null); Assert.Equal(Response.Item1, false); }
public GarmentSupplierViewModel GetEmptyData() { GarmentSupplierViewModel Data = new GarmentSupplierViewModel(); Data.name = string.Empty; Data.code = string.Empty; Data.usevat = true; Data.import = true; Data.usetax = true; Data.IncomeTaxes = null; return(Data); }
public GarmentSupplierViewModel GetNewData() { long nowTicks = DateTimeOffset.Now.Ticks; var data = new GarmentSupplierViewModel { code = $"SupplierCode{nowTicks}", name = $"SupplierName{nowTicks}", import = true }; return(data); }
public GarmentSupplier MapToModel(GarmentSupplierViewModel GarmentSupplierVM) { GarmentSupplier GarmentSupplier = new GarmentSupplier(); GarmentSupplier.Id = GarmentSupplierVM.Id; GarmentSupplier.UId = GarmentSupplierVM.UId; GarmentSupplier._IsDeleted = GarmentSupplierVM._IsDeleted; GarmentSupplier.Active = GarmentSupplierVM.Active; GarmentSupplier._CreatedUtc = GarmentSupplierVM._CreatedUtc; GarmentSupplier._CreatedBy = GarmentSupplierVM._CreatedBy; GarmentSupplier._CreatedAgent = GarmentSupplierVM._CreatedAgent; GarmentSupplier._LastModifiedUtc = GarmentSupplierVM._LastModifiedUtc; GarmentSupplier._LastModifiedBy = GarmentSupplierVM._LastModifiedBy; GarmentSupplier._LastModifiedAgent = GarmentSupplierVM._LastModifiedAgent; GarmentSupplier.Code = GarmentSupplierVM.code; GarmentSupplier.Name = GarmentSupplierVM.name; GarmentSupplier.Address = GarmentSupplierVM.address; GarmentSupplier.Contact = GarmentSupplierVM.contact; GarmentSupplier.PIC = GarmentSupplierVM.PIC; GarmentSupplier.Import = !Equals(GarmentSupplierVM.import, null) ? Convert.ToBoolean(GarmentSupplierVM.import) : false; GarmentSupplier.UseVat = !Equals(GarmentSupplierVM.usevat, null) ? Convert.ToBoolean(GarmentSupplierVM.usevat) : false; GarmentSupplier.UseTax = !Equals(GarmentSupplierVM.usetax, null) ? Convert.ToBoolean(GarmentSupplierVM.usetax) : false; /* Check Null */ if (GarmentSupplierVM.IncomeTaxes != null) { GarmentSupplier.IncomeTaxesId = GarmentSupplierVM.IncomeTaxes.Id; GarmentSupplier.IncomeTaxesName = GarmentSupplierVM.IncomeTaxes.name; GarmentSupplier.IncomeTaxesRate = !Equals(GarmentSupplierVM.IncomeTaxes.rate, null) ? Convert.ToDouble(GarmentSupplierVM.IncomeTaxes.rate) : null; } else { GarmentSupplier.IncomeTaxesId = 1; GarmentSupplier.IncomeTaxesName = ""; GarmentSupplier.IncomeTaxesRate = 0; } GarmentSupplier.NPWP = GarmentSupplierVM.NPWP; GarmentSupplier.SerialNumber = GarmentSupplierVM.serialNumber; return(GarmentSupplier); }