private bool DeductBalanceForCancellingGRN(Guid UnloadingId, SqlTransaction tran) { bool isSaved = false; // get stacks unloaded. List <StackUnloadedBLL> list = null; StackUnloadedBLL o = new StackUnloadedBLL(); o.UnloadingId = UnLoadingId; list = o.GetStackInformationByUnloadingId(); if (list != null) { if (list.Count > 0) { foreach (StackUnloadedBLL i in list) { InventoryServices.GetInventoryService().LoadFromStack(i.StackId, i.NumberOfbags, 0, tran); } } } else { isSaved = false; } return(isSaved); }
public StackUnloadedBLL(StackUnloadedBLL source) { this.Id = source.Id; this.UnloadingId = source.UnloadingId; this.StackId = source.StackId; this.UserId = source.UserId; this.NumberOfbags = source.NumberOfbags; this.Status = source.Status; this.Remark = source.Remark; this.CreatedBy = source.CreatedBy; this.CreatedTimestamp = source.CreatedTimestamp; this.LastModifiedBy = source.LastModifiedBy; this.LastModifiedTimestamp = source.LastModifiedTimestamp; }
public bool Update(SqlTransaction tran) { bool isSaved = false; try { // old object StackUnloadedBLL oldobj = new StackUnloadedBLL(); oldobj = oldobj.GetById(this.Id); AuditTrailBLL objAt = new AuditTrailBLL(); int at = -1; if (oldobj.Status == this.Status) { return(true); } if (oldobj.Status == StackUnloadedStatus.New && this.Status == StackUnloadedStatus.Cancelled) { UpdateInventory(this.StackId, (-1 * this.NumberOfbags), 0, tran); } else if (oldobj.Status == StackUnloadedStatus.New && this.Status == StackUnloadedStatus.Cancelled) { UpdateInventory(this.StackId, this.NumberOfbags, 0, tran); } isSaved = StackUnloadedDAL.UpdateStackUnloaded(this, tran); if (isSaved == true) { at = objAt.saveAuditTrail(oldobj, this, WFStepsName.EditUnloading.ToString(), UserBLL.GetCurrentUser(), "Edit Unloading"); if (at == 1) { isSaved = true; } else { isSaved = false; } } else { isSaved = false; } } catch (Exception ex) { throw ex; } return(isSaved); }
public bool Add(List <StackUnloadedBLL> list) { Nullable <Guid> Id = null; int Count = 1; Count = UnloadingDAL.GetNumberofUnloadingByGradeingResultId(this.GradingResultId); if (Count == 0) { SqlTransaction tran; SqlConnection conn = new SqlConnection(); conn = Connection.getConnection(); tran = conn.BeginTransaction(); try { Id = UnloadingDAL.InsertUnloadingInformation(this, tran); if (Id == null) { tran.Rollback(); conn.Close(); return(false); } else { // add the Stack information this.Id = (Guid)Id; StackUnloadedBLL stackObj = new StackUnloadedBLL(); bool isSavedList = false; isSavedList = stackObj.Add(tran, list, (Guid)Id); if (isSavedList == true) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrail(this, WFStepsName.AddUnloadingInfo.ToString(), UserBLL.GetCurrentUser(), "Add Unloading Information"); if (at == 1) { isSavedList = true; } else { isSavedList = false; } } if (isSavedList == true) { WFTransaction.WorkFlowManager(this.TrackingNo); } if (isSavedList == true) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } } catch (Exception ex) { throw ex; } finally { tran.Dispose(); conn.Close(); } } else { return(false); } }