public void BarkodOkut(string barkod) { AnaKumas = db.GetGeneric <vHamKumaslar>(c => c.Barkod == barkod && c.PartiId.HasValue == false).FirstOrDefault(); if (AnaKumas == null) { throw new Exception("Barkod bulunamadı..!"); } ParcaKumas = AnaKumas.CopyToNewObject(); ParcaKumas.Metre = 0; ParcaKumas.Kg = 0; ParcaKumas.Id = 0; ParcaKumas.NetMetre = 0; ParcaKumas.Barkod = ""; }
public bool Parcala() { if (this.AnaKumas == null || this.ParcaKumas == null) { throw new Exception("Barkod okutulmamış..!"); } if (this.ParcaKumas.Metre <= 0) { throw new Exception("Kesilen metre 0'dan büyük olmalıdır."); } if (this.ParcaKumas.Kg <= 0) { throw new Exception("Kg 0'dan büyük olmalıdır."); } if (this.ParcaKumas.Metre > this.AnaKumas.Metre) { throw new Exception("Fazla metre kesilemez..!\n\nMamul metresi : " + this.AnaKumas.Metre.ToString()); } if (this.ParcaKumas.Kg > this.AnaKumas.Kg) { throw new Exception("Kesilenin kg'ı barkoddan fazla olamaz..!\n\nMamul kg : " + this.AnaKumas.Kg.ToString()); } ParcaKumas.NetMetre = ParcaKumas.Metre; AnaKumas.Metre = Math.Round((AnaKumas.Metre - ParcaKumas.Metre), 2); AnaKumas.NetMetre = Math.Round((AnaKumas.NetMetre - ParcaKumas.NetMetre), 2); AnaKumas.Kg = Math.Round((AnaKumas.Kg - ParcaKumas.Kg), 2); if (db.UpdateGeneric <tblHamKumaslar>(AnaKumas.ViewToTbl())) { tblHamKumaslar hamtbl = this.ParcaKumas.ViewToTbl(); db.SaveGeneric <tblHamKumaslar>(ref hamtbl); this.ParcaKumas.Id = hamtbl.Id; this.ParcaKumas.Barkod = ('H' + hamtbl.Id.ToString()).PadLeft(10, '0'); return(db.UpdateGeneric <tblHamKumaslar>(this.ParcaKumas.ViewToTbl())); } return(false); }