public override string ToString() { var sb = new StringBuilder("ContactTransition("); bool __first = true; if (OwnerMid != null && __isset.ownerMid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("OwnerMid: "); OwnerMid.ToString(sb); } if (TargetMid != null && __isset.targetMid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("TargetMid: "); TargetMid.ToString(sb); } if (__isset.previousStatus) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PreviousStatus: "); PreviousStatus.ToString(sb); } if (__isset.resultStatus) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ResultStatus: "); ResultStatus.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public bool Update(string GRN_number, GRNStatus Status, GRNBLL objGRN, string TrackingNo, DateTime ManagerApprovedDateTime) { bool isSaved = false; SqlTransaction trans; SqlConnection conn = new SqlConnection(); conn = Connection.getConnection(); trans = conn.BeginTransaction(); GRNStatus PreviousStatus; PreviousStatus = (GRNStatus)objGRN.Status; if (objGRN == null) { throw new Exception("Unable to Load GRN Data"); } else { if (objGRN.Id == null || objGRN.Id == Guid.Empty) { throw new Exception("Invalid Grading Information "); } } GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(objGRN.GradingId); objGrading.TrackingNo = TrackingNo; if (Status != GRNStatus.Cancelled) { if (objGrading == null) { throw new Exception("Unable to Load GRN Data"); } else { if (objGrading.TrackingNo == "") { throw new Exception("Unable to Load GRN Data"); } else { TrackingNo = objGrading.TrackingNo; } } } try { if (Status == GRNStatus.ManagerApproved) { isSaved = GRNDAL.SetGRNStatus(GRN_number, Status, trans, ManagerApprovedDateTime); if (isSaved == true) { int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); string oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.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) { WarehouseRecieptBLL objWarehouseReciept = new WarehouseRecieptBLL(objGRN); if (objWarehouseReciept.Save() == true) { WFTransaction.WorkFlowManager(TrackingNo); isSaved = true; } else { isSaved = false; } } else { isSaved = false; } } else { isSaved = false; } } else if (Status == GRNStatus.Cancelled) { //Canceling Update isSaved = false; isSaved = GRNDAL.SetGRNStatus(GRN_number, Status, trans, ManagerApprovedDateTime); if (isSaved == true) { int At = -1; AuditTrailBLL objAt = new AuditTrailBLL(); string oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.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) { ECXWF.CMessage msg = WFTransaction.Request(TrackingNo); if (msg == null) { throw new Exception("Unable to get WF Data."); } else if (msg.Name.Trim() == "EditGRN") { WFTransaction.WorkFlowManager(TrackingNo, msg); isSaved = true; } } } } else { isSaved = false; } #region Depricatedcode //// Cancel Implemented by web service. //if (Status == GRNStatus.Cancelled) //{ // WarehouseRecieptBLL objWarehouseReciept = new WarehouseRecieptBLL(); // isSaved = GRNDAL.UpdateGRN(GRN_number, Status, trans); // if (isSaved == true) // { // //isSaved = objWarehouseReciept.Cancel(this.Id); // if (isSaved == true) // { // int At = -1; // AuditTrailBLL objAt = new AuditTrailBLL(); // string oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.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) // { // isSaved = true; // } // else // { // isSaved = false; // } // } // } // else // { // throw new Exception("Unable to Cancel GRN."); // } // if (isSaved == true) // { // WFTransaction.WorkFlowManager(TrackingNo); // } //} #endregion if (isSaved == true) { trans.Commit(); trans.Dispose(); conn.Close(); return(true); } else { trans.Rollback(); trans.Dispose(); conn.Close(); } } catch (Exception ex) { trans.Rollback(); throw ex; } finally { trans.Dispose(); conn.Close(); } return(false); }