public bool Add(SqlTransaction tran) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); try { if (StackUnloadedDAL.InsertStackUnloaded(this, tran) == true) { at = objAt.saveAuditTrail(this, WFStepsName.AddUnloadingInfo.ToString(), UserBLL.GetCurrentUser(), "Add statck Unloaded"); if (at == 1) { return(true); } } else { return(false); } } catch (Exception ex) { throw ex; } return(false); }
public bool Save(SqlTransaction tran) { bool isSaved = false; try { isSaved = TrucksMissingOnSamplingDAL.Insert(this, tran); if (isSaved == true) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrail(this, WFStepsName.ConfirmTrucksForsamp.ToString(), UserBLL.GetCurrentUser(), "Missing On Confirmation"); if (at != 1) { isSaved = false; } } } catch (Exception ex) { throw ex; } return(isSaved); }
public bool save(List <GradingFactorGroupDetailBLL> list, SqlTransaction tran, Guid GroupId) { bool isSaved = false; isSaved = GradingFactorGroupDetailDAL.save(list, tran, GroupId); if (isSaved == true) { isSaved = false; //Create audit Trail int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); string Str = "New Id - ["; foreach (GradingFactorGroupDetailBLL o in list) { Str += o.Id.ToString() + " , "; } Str += " ] "; At = objAt.saveAuditTrailStringFormat("New Record-Grading Factor Group detail", Str, WFStepsName.GradingFactorGroupAd.ToString(), UserBLL.GetCurrentUser(), "Grading Factor Detail"); if (At == 1) { isSaved = true; } else { isSaved = false; } } return(isSaved); }
public bool Update() { bool issaved = false; SqlTransaction tran = null;; SqlConnection conn = null; conn = Connection.getConnection(); UnloadingBLL objOld = new UnloadingBLL(); objOld = objOld.GetById(this.Id); if (objOld == null) { throw new Exception("Null Old Value Exception"); } try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); if (UnloadingDAL.UpdateUnloading(this, tran) == true) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrail(objOld, this, WFStepsName.EditUnloading.ToString(), UserBLL.GetCurrentUser(), "Edit Unloading"); if (at == 1) { tran.Commit(); issaved = true; } else { tran.Rollback(); issaved = false; } } else { tran.Rollback(); issaved = false; } } catch { tran.Rollback(); throw new Exception("Unable to Update the record."); } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Dispose(); } } return(issaved); }
public bool UpdateGRNNumber(Guid Id, String oldSystemGRNNumber, string newSystemGRNNumber, string TrackingNo) { bool isSaved = true; SqlTransaction trans; SqlConnection conn = new SqlConnection(); conn = Connection.getConnection(); trans = conn.BeginTransaction(); try { isSaved = GRNDAL.UpDateGRNNumber(Id, oldSystemGRNNumber, newSystemGRNNumber, trans); if (isSaved == true) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); if (TrackingNo != "-1") { WFTransaction.WorkFlowManager(TrackingNo); } at = objAt.saveAuditTrailStringFormat("New System:GRN_Number = " + newSystemGRNNumber, "Old System :GRN_Number = " + oldSystemGRNNumber, "GRN No. Update ", UserBLL.GetCurrentUser(), WFStepName.UpdateGRNNo.ToString()); if (at == 1) { trans.Commit(); return(true); } else { trans.Rollback(); return(false); } } else { trans.Rollback(); return(false); } } catch (Exception ex) { trans.Rollback(); throw ex; } finally { if (trans != null) { trans.Dispose(); } if (conn != null) { if (conn.State == ConnectionState.Open) { conn.Close(); } } } return(isSaved); }
/// <summary> /// if a total value exists for a Commodity grade it will update else it will create a new one /// </summary> /// <returns></returns> public bool Update(CommodityGradeTotalValueBLL oldObject) { SqlTransaction tran = null; SqlConnection conn = Connection.getConnection(); bool isSaved = false; try { tran = conn.BeginTransaction(); if (CommodityGradeTotalValueDAL.Update(this, tran) == true) { // take audit trail int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); if (oldObject != null) { at = objAt.saveAuditTrail(oldObject, this, WFStepsName.CommodityGradeTotalValue.ToString(), UserBLL.GetCurrentUser(), "Update CGTV"); } else { at = objAt.saveAuditTrail(this, WFStepsName.CommodityGradeTotalValue.ToString(), UserBLL.GetCurrentUser(), "Add CGTV"); } if (at == 1) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } else { return(isSaved); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); } } return(false); }
public Boolean Update() { // TODO : Check Sampling is Completed - check if Code is generated. int count = 0; bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; SamplingResultBLL objSamplingResultold = new SamplingResultBLL(); objSamplingResultold = objSamplingResultold.GetSamplingResultById(this.Id); if (objSamplingResultold == null) { throw new Exception("Null Old Value Exception"); } try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); count = SamplingResultDAL.GetNumberofSupervisorResults(this.Id); if (count > 0) { throw new Exception("A supervisor result with new or Approved already exists."); } else { isSaved = SamplingResultDAL.UpdateSamplingResult(this, tran); if (isSaved == true) { int at = -1; AuditTrailBLL objat = new AuditTrailBLL(); objat.saveAuditTrail(objSamplingResultold, this, WFStepsName.EditSamplingResult.ToString(), UserBLL.GetCurrentUser(), "Edit Sampling Result"); if (at == 1) { tran.Commit(); } else { isSaved = false; tran.Rollback(); } } return(isSaved); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { tran.Dispose(); conn.Close(); } }
public bool ClientAcceptance(string GRN_number, DateTime AccptedTimeStamp, bool CAStatus, string TrackingNo, GRNStatus prevStatus) { bool isSaved = false; SqlTransaction trans; SqlConnection conn = new SqlConnection(); conn = Connection.getConnection(); trans = conn.BeginTransaction(); int status; if (CAStatus == true) { status = 4; } else { status = 5; } try { isSaved = GRNDAL.ClientAcceptance(GRN_number, AccptedTimeStamp, CAStatus, status, trans); if (isSaved == true) { int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); string oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + prevStatus.ToString() + ")"; string NewVal = "(GRNNo-" + GRN_number + ") , (Status-" + Status.ToString() + ")"; At = objAt.saveAuditTrailStringFormat(oldVal, NewVal, WFStepName.EditGRN.ToString(), UserBLL.GetCurrentUser(), "Change GRN Status"); if (At == 1) { WFTransaction.WorkFlowManager(TrackingNo); } else { isSaved = false; } } if (isSaved == true) { trans.Commit(); trans.Dispose(); conn.Close(); return(true); } } catch (Exception ex) { trans.Rollback(); trans.Dispose(); conn.Close(); throw ex; } return(false); }
public bool Add() { bool isSaved = false; SqlConnection conn = new SqlConnection(); SqlTransaction tran; conn = Connection.getConnection(); tran = conn.BeginTransaction(); try { string TrackingNo = ""; TrackingNo = WFTransaction.GetTransaction("WHEditAppGRN", tran); this.TrackingNo = TrackingNo; this.Id = Guid.NewGuid(); isSaved = RequestforEditGRNDAL.save(tran, this); if (isSaved == true) { int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); At = objAt.saveAuditTrail(this, WFStepsName.RequestforEditGRN.ToString(), UserBLL.GetCurrentUser(), "Add Approved GRN Edit"); if (At == 1) { tran.Commit(); } else { tran.Rollback(); } } else { if (TrackingNo != "") { WFTransaction.Close(TrackingNo); } tran.Rollback(); } } catch (Exception ex) { tran.Rollback(); throw new Exception("Unable to Add New record", ex); } finally { tran.Dispose(); if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Dispose(); } return(isSaved); }
public bool Add() { bool issaved = false; SqlTransaction tran = null; SqlConnection conn = null; try { this.Id = Guid.NewGuid(); conn = Connection.getConnection(); tran = conn.BeginTransaction(); issaved = StackDAL.InsertStack(this, tran); if (issaved == true) { int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrail(this, WFStepsName.Stack.ToString(), UserBLL.GetCurrentUser(), "Add Stack"); if (at == 1) { tran.Commit(); issaved = true; } else { tran.Rollback(); issaved = false; } } else { tran.Rollback(); issaved = false; } } catch (Exception ex) { tran.Rollback(); issaved = false; throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } return(issaved); }
public bool UpdateStatus() { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; int at = -1; try { TrucksMissingOnSamplingBLL objNew = new TrucksMissingOnSamplingBLL(); TrucksMissingOnSamplingBLL objOld = TrucksMissingOnSamplingDAL.GetById(this.Id); objNew = objOld.Copy(objOld); objNew.Id = this.Id; objNew.Status = this.Status; conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = TrucksMissingOnSamplingDAL.SetStatus(objNew.Id, objNew.Status, tran); if (isSaved == true) { AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrail(objNew, objOld, WFStepsName.TrucksMissingForSamp.ToString(), UserBLL.GetCurrentUser(), "Update Status Missing Traucks"); if (at == 1) { tran.Commit(); } else { tran.Rollback(); isSaved = false; } } else { isSaved = false; } } catch (Exception ex) { throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } return(isSaved); }
public bool Save(List <GradingFactorGroupDetailBLL> list) { bool issaved = false; SqlTransaction tran = null; SqlConnection conn = null; int At = -1; try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); this.Id = Guid.NewGuid(); this.CreatedBy = UserBLL.GetCurrentUser(); issaved = GradingFactorGroupDAL.Save(this, tran); if (issaved == true) { issaved = false; GradingFactorGroupDetailBLL objGFD = new GradingFactorGroupDetailBLL(); issaved = objGFD.save(list, tran, this.Id); AuditTrailBLL objAt = new AuditTrailBLL(); At = objAt.saveAuditTrail(this, WFStepsName.GradingFactorGroupAd.ToString(), UserBLL.GetCurrentUser(), "Add Grading Factor Group "); if (At == 1) { tran.Commit(); } else { tran.Rollback(); } } else { tran.Rollback(); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } return(issaved); }
public bool Add(List <GradingResultDetailBLL> list, SqlTransaction trans, Nullable <Guid> Id) { bool isSaved = false; if (Id == null) { trans.Rollback(); trans.Dispose(); return(false); } try { string str = "Grading Factors("; foreach (GradingResultDetailBLL obj in list) { obj.GradingResultId = (Guid)Id; obj.Id = Guid.NewGuid(); isSaved = GradingResultDetailDAL.InsertGradingResultDetail(obj, trans); if (isSaved == false) { throw new Exception("Unable to insert Grading Factor Values"); } else { str += "[Id-" + obj.Id.ToString() + " ,GradingResultId-" + obj.GradingResultId.ToString() + " ,GradingFactorId-" + obj.GradingFactorId.ToString() + " , RecivedValue-" + obj.RecivedValue.ToString() + " , Status-" + obj.Status.ToString() + ", CreateBy-" + UserBLL.GetCurrentUser() + "];"; } } str += ")"; isSaved = true; AuditTrailBLL objAt = new AuditTrailBLL(); int at = -1; at = objAt.saveAuditTrailStringFormat(str, "New data Added", WFStepName.AddGradingResult.ToString(), UserBLL.GetCurrentUser(), "Add Grading Factor Values"); if (at != 1) { isSaved = false; throw new Exception("Unbale to add Audit Trail-Grading Factor Value."); } else { isSaved = true; } } catch (Exception ex) { throw ex; } return(isSaved); }
public bool Cancel(Guid Id) { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; int at = -1; try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = GRNServiceDAL.Cancel(Id, tran); if (isSaved == true) { AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrailStringFormat("[Id=" + Id.ToString() + ",Status=Active]", "[Id=" + Id.ToString() + ",Status=Cancelled]", WFStepsName.GRNServiceCancel.ToString(), UserBLL.GetCurrentUser(), "Cancel GRN service"); if (at == 1) { tran.Commit(); isSaved = true; } else { tran.Rollback(); isSaved = false; } } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } return(isSaved); }
public bool EditDriverInformation(DriverInformationBLL objEdit) { //check if it has a GRN not in Edit mood. if (isGRNEditable(this.ReceivigRequestId) == false) { throw new GRNNotOnUpdateStatus(" This Information can't up updated because the GRN is not on Edit status"); } bool isSaved = false; SqlTransaction tran; SqlConnection Conn = Connection.getConnection(); tran = Conn.BeginTransaction(); int AtStatus = -1; try { DriverInformation objDriverInfoDAL = new DriverInformation(); isSaved = objDriverInfoDAL.UpdateDriverInformation(this, tran); if (isSaved == true) { string AppMode = WFStepsName.EditDriverInfo.ToString(); AuditTrailBLL objAt = new AuditTrailBLL(); AtStatus = objAt.saveAuditTrail(this, objEdit, AppMode, UserBLL.GetCurrentUser(), "DriverInformationUpdate"); if (AtStatus == 1 || AtStatus == 0) { tran.Commit(); } else { tran.Rollback(); } } } catch (Exception ex) { tran.Rollback(); ErrorLogger.Log(ex); return(false); } if (AtStatus == 1 || AtStatus == 0) { return(true); } else { return(false); } }
public bool Update() { bool isSaved = false; SqlConnection conn = null; SqlTransaction tran = null; RequestforApprovedGRNCancelationBLL objEdit = new RequestforApprovedGRNCancelationBLL(); objEdit = objEdit.GetById(Id); try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = RequestforApprovedGRNCancelationDAL.Update(tran, this); if (isSaved == true) { string AppMode = Utility.GetApplicationName() + " - AppGRNCancel"; AuditTrailBLL objAT = new AuditTrailBLL(); if (objAT.saveAuditTrail(objEdit, this, AppMode, UserBLL.GetCurrentUser(), "Update-ApprovedGRNCancelRequest") == 1) { tran.Commit(); } else { tran.Rollback(); return(false); } } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); throw new Exception("Unable to update Data.", ex); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } if (tran != null) { tran.Dispose(); } } return(isSaved); }
public bool Update() { bool isSaved = false; SqlConnection conn = null; SqlTransaction tran = null; ScalingBLL objScaling = new ScalingBLL(); objScaling = objScaling.GetById(this.Id); if (objScaling == null) { throw new Exception("Null Old Value Exception"); } try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = ScalingDAL.Update(this, tran); if (isSaved == true) { int at = -1; AuditTrailBLL objat = new AuditTrailBLL(); at = objat.saveAuditTrail(objScaling, this, WFStepsName.EditScaling.ToString(), UserBLL.GetCurrentUser(), "Update Scaling Information"); if (at == 1) { tran.Commit(); } else { isSaved = false; tran.Rollback(); } } } catch (Exception ex) { throw new Exception("An Error has ccured please try again. If the error persists Contact the Administrator", ex); } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } return(isSaved); }
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 Save() { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = CommodityGradingFactorDAL.Save(this, tran); if (isSaved == true) { isSaved = false; AuditTrailBLL objAt = new AuditTrailBLL(); int at = -1; at = objAt.saveAuditTrail(this, WFStepsName.CommmodityGradingFactor.ToString(), UserBLL.GetCurrentUser(), " Add Comm. Grading Factors "); if (at == 1) { isSaved = true; } } if (isSaved == true) { tran.Commit(); } else { tran.Rollback(); } return(isSaved); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { if (tran != null) { tran.Dispose(); } if (conn.State == ConnectionState.Open) { conn.Close(); } } }
public bool Inactive(Guid Id) { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; conn = Connection.getConnection(); tran = conn.BeginTransaction(); try { isSaved = CommodityGradingFactorDAL.Inactive(Id, tran); if (isSaved == true) { int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); At = objAt.saveAuditTrailStringFormat("", Id.ToString() + " - Staus set to Canceled", WFStepsName.CommmodityGradingFactor.ToString(), UserBLL.GetCurrentUser(), "Cancel Comm. Grading factor"); if (At == 1) { isSaved = true; } else { isSaved = false; } } else { tran.Rollback(); } if (isSaved == true) { tran.Commit(); } else { tran.Rollback(); } return(isSaved); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { } }
public bool Edit(GradingDisputeBLL objOld) { bool isSaved = false; SqlConnection conn; SqlTransaction tran; conn = Connection.getConnection(); tran = conn.BeginTransaction(); try { isSaved = GradingDisputeDAL.UpdateGradingDisputeBLL(this, tran); if (isSaved == true) { //Update the WF step after cheking the status is set to approved. if (this.Status == 2) { WFTransaction.WorkFlowManager(this.TrackingNo); HttpContext.Current.Session["EditGradeDisputeTranNo"] = this.TrackingNo; } else if (this.Status == 3) { HttpContext.Current.Session["EditGradeDisputeTranNo"] = this.TrackingNo; } AuditTrailBLL ATobj = new AuditTrailBLL(); ATobj.saveAuditTrail(objOld, this, WFStepsName.EditGradeDispute.ToString(), UserBLL.GetCurrentUser(), "Edit Grade Dispute"); tran.Commit(); tran.Dispose(); conn.Close(); return(true); } else { tran.Rollback(); tran.Dispose(); conn.Close(); return(false); } } catch (Exception ex) { tran.Rollback(); tran.Dispose(); conn.Close(); throw ex; } }
public bool Add( ) { SqlTransaction tran; SqlConnection conn = new SqlConnection(); conn = Connection.getConnection(); tran = conn.BeginTransaction(); int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); try { conn = Connection.getConnection(); if (StackUnloadedDAL.InsertStackUnloaded(this, tran) == true) { at = objAt.saveAuditTrail(this, WFStepsName.AddUnloadingInfo.ToString(), UserBLL.GetCurrentUser(), "Add statck Unloaded"); if (at == 1) { tran.Commit(); tran.Dispose(); conn.Close(); return(true); } } else { tran.Rollback(); tran.Dispose(); return(false); } } catch { tran.Rollback(); tran.Dispose(); if (at == 1) { objAt.RoleBack(); } return(false); } return(false); }
public bool Save(Guid GRNId, List <GRNServiceBLL> list, SqlTransaction tran) { bool isSaved = false; int at = -1; try { isSaved = GRNServiceDAL.Insert(GRNId, list, tran); if (isSaved == true) { isSaved = false; string strAt = "GRN service ["; foreach (GRNServiceBLL o in list) { strAt += "(Id=" + o.Id.ToString() + ", "; strAt += "ServiceId=" + o.ServiceId.ToString() + ", "; strAt += "Quantity=" + o.Quantity.ToString() + ", "; strAt += "Status=" + o.Status.ToString() + " );"; } strAt += "]"; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrailStringFormat(strAt, "New data Added", WFStepsName.GRNServiceAdd.ToString(), UserBLL.GetCurrentUser(), " Add GRN service "); if (at != 1) { isSaved = false; } else { isSaved = true; } } } catch (Exception ex) { throw ex; } finally { } return(isSaved); }
public bool Add(SqlTransaction tran, List <StackUnloadedBLL> list, Guid Id) { if (list != null && list.Count > 0) { string strAt = "Stack Unloaded "; foreach (StackUnloadedBLL o in list) { o.UnloadingId = Id; if (StackUnloadedDAL.InsertStackUnloaded(o, tran) == false) { return(false); } else { UpdateInventory(o.StackId, o.NumberOfbags, 0, tran); strAt += "[ "; strAt += "(Id-" + o.Id.ToString() + ") , "; strAt += "(UnloadingId-" + o.UnloadingId.ToString() + ") , "; strAt += "(StackId-" + o.StackId.ToString() + "), "; strAt += "(NumberOfBags-" + o.NumberOfbags.ToString() + "), "; strAt += "(Status-" + o.Status.ToString() + "), "; strAt += "(UnloadedBy-" + o.UserId.ToString() + "), "; strAt += "(Remark-" + o.Remark.ToString() + "), "; strAt += "(CreatedBy-" + o.CreatedBy.ToString() + ") "; strAt += " ]"; } } int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrailStringFormat("New Data Added", strAt, WFStepsName.AddUnloadingInfo.ToString(), UserBLL.GetCurrentUser(), "Add statck Unloaded"); if (at == 1) { return(true); } else { return(false); } } else { return(false); } }
public bool SaveNew() { bool isSaved = false; this.CreatedBy = UserBLL.GetCurrentUser(); if ((string.IsNullOrEmpty(this.TruckPlateNo) != true) && (string.IsNullOrEmpty(this.TrailerPlateNo) == true)) { this.hasTrailer = TruckHasTrailerType.TruckOnly; } else if ((string.IsNullOrEmpty(this.TruckPlateNo) == true) && (string.IsNullOrEmpty(this.TrailerPlateNo) != true)) { this.hasTrailer = TruckHasTrailerType.TrailerOnly; } else if ((string.IsNullOrEmpty(this.TruckPlateNo) != true) && (string.IsNullOrEmpty(this.TrailerPlateNo) != true)) { this.hasTrailer = TruckHasTrailerType.TruckTrailer; } else if ((string.IsNullOrEmpty(this.TruckPlateNo) == true) && (string.IsNullOrEmpty(this.TrailerPlateNo) == true)) { throw new Exception("Truck Plate No. And Trailer Plate No. Are Both Empty"); } this.Status = TruckWeightStatus.Active; //THE FOLLOWING METHOD ADDED BY SINISHAW isSaved = TruckWeightDAL.InsertNew(this); AuditTrailBLL objAt = new AuditTrailBLL(); int at = -1; if (isSaved == true) { at = objAt.saveAuditTrail(this, WFStepsName.RegisterTruckWeight.ToString(), UserBLL.GetCurrentUser(), "Scaling Information"); if (at == 1) { isSaved = true; } else { isSaved = false; } } return(isSaved); }
//oublic Functions public bool Add(Guid Id, List <GradingByBLL> list, SqlTransaction tran) { if (list.Count > 0) { try { string strAt = ""; foreach (GradingByBLL i in list) { bool isSaved = false; i.GradingId = Id; isSaved = GradingByDAL.InsertGraders(i, tran); if (isSaved == false) { return(false); } else { strAt += "[(Id-" + i.Id.ToString() + "),(GradingId-" + i.GradingId.ToString() + "),(UserId-" + i.UserId.ToString() + "),(Status-" + i.Status.ToString() + "),(isSupervisor-" + isSupervisor.ToString() + "),(CreatedBy" + UserBLL.GetCurrentUser().ToString() + ")] ; "; } } int at = -1; AuditTrailBLL objAt = new AuditTrailBLL(); at = objAt.saveAuditTrailStringFormat("New Data added", strAt, WFStepsName.GenerateGradingCode.ToString(), UserBLL.GetCurrentUser(), "Add Grader"); if (at == 1) { return(true); } else { return(false); } } catch { new Exception("Unable to Add Graders."); } } return(false); }
public bool Update(GradingFactorBLL oldGF) { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = GradingFactorDAL.Update(this, tran); int At = -1; if (isSaved == true) { AuditTrailBLL objAT = new AuditTrailBLL(); At = objAT.saveAuditTrail(this, oldGF, WFStepsName.GradingFactorUpdate.ToString(), UserBLL.GetCurrentUser(), "Update Grading Factor"); } if (At == 1) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); throw new Exception("Unable to saved reocrd", ex); } finally { tran.Dispose(); if (conn.State == ConnectionState.Open) { conn.Close(); } } }
public bool UpdateEach(Guid Id, string Value) { //get the old SqlTransaction tran; SqlConnection conn = Connection.getConnection(); bool isSaved = false; GradingResultDetailBLL objOld = GradingResultDetailDAL.GetGradingResultDetailById(Id); GradingResultDetailBLL objNew = objOld; objNew.RecivedValue = Value; tran = conn.BeginTransaction(); try { isSaved = GradingResultDetailDAL.UpdateGradingResultDetailEach(Id, Value, tran); AuditTrailBLL objAt = new AuditTrailBLL(); int x = objAt.saveAuditTrail(objOld, objNew, Utility.GetApplicationName(), UserBLL.GetCurrentUser(), "Update Grading factorValue"); if (x == 1 && isSaved == true) { tran.Commit(); } else if (isSaved == true && x == -1) { tran.Rollback(); isSaved = false; objAt.RoleBack(); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { tran.Dispose(); conn.Close(); } 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); } }
public bool Update() { bool isSaved = false; SqlConnection conn = null; SqlTransaction tran = null; RequestforEditGRNBLL objEdit = new RequestforEditGRNBLL(); objEdit = objEdit.GetById(Id); AuditTrailBLL objAt = new AuditTrailBLL(); try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = RequestforEditGRNDAL.Update(tran, this); if (isSaved == true) { string AppMode = WFStepsName.EditAppGRN.ToString(); if (objAt.saveAuditTrail(objEdit, this, AppMode, UserBLL.GetCurrentUser(), "Update-ApprovedGRNCancelRequest") == 1) { if (objEdit.Status == RequestforEditGRNStatus.New && this.Status == RequestforEditGRNStatus.Approved) { WFTransaction.WorkFlowManager(this.TrackingNo); } else if (objEdit.Status == RequestforEditGRNStatus.New && this.Status == RequestforEditGRNStatus.Approved) { WFTransaction.Close(this.TrackingNo); } tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); throw new Exception("Unable to update Data.", ex); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } if (tran != null) { tran.Dispose(); } } }