internal PacificCode GetNewPacificCode(int amount) { /// Tao PacificCode mà chưa tồn tại bool isExistPacfificCode = false; string codeNumber; do { codeNumber = GeneratorPacificCode.Generator.getNewCode(); isExistPacfificCode = PacificCodeBUS.IsExist(codeNumber); } while (isExistPacfificCode); PacificCode newPacificCode = new PacificCode(); newPacificCode.CodeNumber = codeNumber; newPacificCode.ActualAmount = amount; newPacificCode.InitialAmount = amount; newPacificCode.CreateDate = DateTime.Now; int iYear = DateTime.Now.Year + 1; int iMonth = DateTime.Now.Month; int iDay = DateTime.Now.Day; newPacificCode.ExpireDate = new DateTime(iYear, iMonth, iDay); PacificCodeDAO.AddNew(newPacificCode); return newPacificCode; }
internal static bool AddNew(PacificCode entity) { MoneyPacificBlackBoxDataContext db = Connection.Instance; entity.Id = Guid.NewGuid(); db.PacificCodes.InsertOnSubmit(entity); db.SubmitChanges(); return true; }
internal void SetAttritebuteValue(PacificCode pacificCode) { this._pacificCode = pacificCode; this.CodeNumber = pacificCode.CodeNumber; this.PartCodeNumber = pacificCode.CodeNumber.Substring(0, 12); this.ActualAmount = (int)pacificCode.ActualAmount; this.InitialAmount = (int)pacificCode.InitialAmount; this.ExpireDate = (DateTime)pacificCode.ExpireDate; this.CreateDate= (DateTime)pacificCode.CreateDate; }
internal void CopyFrom(PacificCode entity) { this.CodeNumber = entity.CodeNumber; this.ActualAmount = entity.ActualAmount; this.InitialAmount = entity.InitialAmount; this.Comment = entity.Comment; this.CreateDate = entity.CreateDate; this.ExpireDate = entity.ExpireDate; this.LastDate = entity.LastDate; this.LastTransaction = entity.LastTransaction; this.StatusId = entity.StatusId; }
internal static bool Update(PacificCode entity) { // TODO:(không sử dụng) MoneyPacificBlackBoxDataContext db = Connection.Instance; if (!IsExist(entity.Id)) { return false; } PacificCode existPacificCode = db.PacificCodes .Where(p => p.Id == entity.Id).Single<PacificCode>(); existPacificCode.CopyFrom(entity); db.SubmitChanges(); return true; }
private void detach_PacificCodes(PacificCode entity) { this.SendPropertyChanging(); entity.PacificCodeState = null; }
partial void DeletePacificCode(PacificCode instance);
partial void UpdatePacificCode(PacificCode instance);
partial void InsertPacificCode(PacificCode instance);