Пример #1
0
        public SamplingResultBLL GetGradingDisputePendingCodingByTrackingNo(string TrackingNo)
        {
            SamplingResultBLL obj = new SamplingResultBLL();

            obj = GradingDisputeDAL.GetGradingDisputePendingCodingByTrackingNo(TrackingNo);
            return(obj);
        }
Пример #2
0
        public int GetNumberOfSeparations(Guid SamplingResultId)
        {
            SamplingResultBLL obj  = new SamplingResultBLL();
            int numberofSeparation = 0;

            obj = SamplingResultDAL.GetActiveSamplingResultBySamplingId(SamplingResultId);
            numberofSeparation = obj.NumberOfSeparations;
            return(numberofSeparation);
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
        public SamplingResultBLL GetSamplesResultsPendingCodingByTrackingNo(Guid WarehouseId, string TrackingNo)
        {
            SamplingResultBLL list = new SamplingResultBLL();

            list = SamplingResultDAL.GetSamplesResultsPendingCodingByTrackingNo(WarehouseId, TrackingNo);
            if (list == null)
            {
                GradingDisputeBLL objGD = new GradingDisputeBLL();
                list = objGD.GetGradingDisputePendingCodingByTrackingNo(TrackingNo);
            }
            return(list);
        }
Пример #5
0
 public SamplingResultBLL(SamplingResultBLL source)
 {
     this._id                    = source._id;
     this._samplingId            = source._samplingId;
     this._employeeId            = source._employeeId;
     this._numberOfBags          = source._numberOfBags;
     this._numberOfSeparations   = source._numberOfSeparations;
     this._samplerComments       = source._samplerComments;
     this._isSupervisor          = source._isSupervisor;
     this._isSupervisor          = source._isSupervisor;
     this._status                = source._status;
     this._remark                = source._remark;
     this._createdBy             = source._createdBy;
     this._createdTimestamp      = source._createdTimestamp;
     this._lastModifiedBy        = source._lastModifiedBy;
     this._lastModifiedTimestamp = source._lastModifiedTimestamp;
 }
Пример #6
0
        private static List <TransactionDetail> getDislayName(string[] TranArr, string FlowName, string StepName)
        {
            string str = "";
            List <TransactionDetail> list;

            for (int i = 0; i < TranArr.Count(); i++)
            {
                if (i < TranArr.Count() - 1)
                {
                    str += "'" + TranArr[i].ToString() + "' ,";
                }
                else
                {
                    str += "'" + TranArr[i].ToString() + "'";
                }
            }
            list = new List <TransactionDetail>();
            if (StepName == WFStepName.AddSamplingResult.ToString())
            {
                SamplingBLL objSampling = new SamplingBLL();
                if (FlowName.Trim().ToUpper() == "WRCM".ToUpper())
                {
                    TranArr = objSampling.GetMixedSamplingCodeBylistTrackingNo(str);
                }
                else
                {
                    TranArr = objSampling.GetSamplingCodeBylistTrackingNo(str);
                }
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.GenerateGradingCode.ToString())
            {
                SamplingResultBLL objSampling = new SamplingResultBLL();
                TranArr = objSampling.GetSamplingResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    if (TranArr != null)
                    {
                        for (int x = 0; x < TranArr.Count(); x++)
                        {
                            string[] temp = TranArr[x].Split('*');
                            list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                        }
                    }
                }
                // regrading
                GradingDisputeBLL objGradeDispute = new GradingDisputeBLL();
                TranArr = objGradeDispute.GetReGradingRequestbyTrackingNo(str);
                if (TranArr != null)
                {
                    if (TranArr != null)
                    {
                        for (int x = 0; x < TranArr.Count(); x++)
                        {
                            string[] temp = TranArr[x].Split('*');
                            list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                        }
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.AddGradingResult.ToString())
            {
                GradingBLL objSampling = new GradingBLL();
                TranArr = objSampling.GetGradingResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.GradingResultCA.ToString())
            {
                GradingBLL objSampling = new GradingBLL();
                TranArr = objSampling.GetGradingResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }


                return(list);
            }
            else if (StepName == WFStepName.PreWeighTruck.ToString() || StepName == WFStepName.AddUnloadingInfo.ToString())
            {
                GradingResultBLL obj = new GradingResultBLL();
                TranArr = obj.GetGradingResultResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.PostWeighTruck.ToString() || StepName == WFStepName.AddScalingInfo.ToString())
            {
                //TODO _ check hwewe
                //post Weight que No.
                GradingResultBLL obj = new GradingResultBLL();
                TranArr = obj.GetGradingResultResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.AddGRN.ToString())
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGradingResultResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.GRNAcceptance.ToString() && FlowName == "WHEditAppGRN")
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGRNNoBylistEditTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.GRNAcceptance.ToString() && FlowName != "WHEditAppGRN")
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGRNNoBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            //Update GRN
            else if (StepName == WFStepName.UpdateGRNNo.ToString())
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGRNNoBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.WarehouseManagerAppr.ToString() && FlowName == "WHEditAppGRN")
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGRNNoBylistEditTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepName.EditGRN.ToString() || StepName == WFStepName.WarehouseManagerAppr.ToString())
            {
                GRNBLL obj = new GRNBLL();
                TranArr = obj.GetGRNNoBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else if (StepName == WFStepsName.EditGradingResult.ToString())
            {
                string            strTr;
                GradingDisputeBLL objGrDisp = new GradingDisputeBLL();
                TranArr = objGrDisp.GetReGradingRequestbyTrackingNo(str);

                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }

                return(list);
            }
            else if (StepName.ToUpper().Trim() == "CodeSampRec".ToUpper().Trim())
            {
                GradingBLL objSampling = new GradingBLL();
                TranArr = objSampling.GetGradingResultCodeBylistTrackingNo(str);
                if (TranArr != null)
                {
                    for (int x = 0; x < TranArr.Count(); x++)
                    {
                        string[] temp = TranArr[x].Split('*');
                        list.Add(new TransactionDetail(temp[0].Trim(), temp[1].Trim()));
                    }
                }
                return(list);
            }
            else
            {
                for (int x = 0; x < TranArr.Count(); x++)
                {
                    list.Add(new TransactionDetail(TranArr[x].Trim(), TranArr[x].Trim()));
                }
                return(list);
            }
        }
Пример #7
0
        public Boolean UpdateManagerApproval(SamplingResultBLL oldObj)
        {
            // TODO : Check Sampling is Completed - check if Code is generated.

            bool           isSaved = false;
            SqlTransaction tran    = null;
            SqlConnection  conn    = null;
            AuditTrailBLL  objat   = new AuditTrailBLL();
            int            at      = -1;

            try
            {
                conn = Connection.getConnection();
                tran = conn.BeginTransaction();
                this.LastModifiedBy = UserBLL.GetCurrentUser();
                isSaved             = SamplingResultDAL.UpdateManagerApproval(this, tran);
                if (isSaved == true)
                {
                    if (oldObj == null)
                    {
                        throw new Exception("Invalid Old object-UpdateManagerApproval Method.");
                    }
                    string strOld = "(Id-" + oldObj.Id.ToString() + ")," + "(Status-" + oldObj.Status.ToString() + "),(LastModifiedBy-" + oldObj.LastModifiedBy.ToString() + ")";
                    string strNew = "(Id-" + this.Id.ToString() + ")," + "(Status-" + this.Status.ToString() + "),(LastModifiedBy-" + this.LastModifiedBy.ToString() + ")";
                    strNew += "(ManagerApprovalRemark-" + this.ManagerApprovalRemark + "),(LastModifiedTimestamp-" + this.LastModifiedTimestamp.ToString() + ")";
                    at      = objat.saveAuditTrailStringFormat(strOld, strNew, WFStepsName.EditSamplingResult.ToString(), UserBLL.GetCurrentUser(), "Edit Sampling Result");
                    if (at == 1)
                    {
                        if ((oldObj.Status == SamplingResultStatus.New) && (this.Status == SamplingResultStatus.Approved))
                        {
                            ECXWF.CMessage mess = WFTransaction.Request(this.TrackingNo);
                            HttpContext.Current.Session["msg"] = mess;
                            if (mess.Name.Trim().ToUpper() == "AddSamplingResult".ToUpper())
                            {
                                WFTransaction.WorkFlowManager(this.TrackingNo);
                            }
                            else
                            {
                                throw new Exception("The Task has already been done.");
                            }
                        }
                        else if ((oldObj.Status == SamplingResultStatus.New) && (this.Status == SamplingResultStatus.Cancelled))
                        {
                            ECXWF.CMessage mess = WFTransaction.Request(this.TrackingNo);
                            HttpContext.Current.Session["msg"] = mess;
                            if (mess.Name.Trim().ToUpper() == "AddSamplingResult".ToUpper())
                            {
                                WFTransaction.Close(this.TrackingNo);
                            }
                            else
                            {
                                throw new Exception("The Task has already been done.");
                            }
                        }
                    }
                    else
                    {
                        objat.RoleBack();
                        tran.Rollback();
                        isSaved = false;
                    }



                    if (at == 1)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        isSaved = false;
                        tran.Rollback();
                    }
                }
                return(isSaved);
            }
            catch (Exception ex)
            {
                if (at == 1)
                {
                    objat.RoleBack();
                }
                tran.Rollback();
                throw ex;
            }
            finally
            {
                tran.Dispose();
                conn.Close();
            }
        }
Пример #8
0
        public bool Add(string WarehouseNo, string TrackingNo, List <GradingByBLL> list)
        {
            //Utility.LogException(new Exception(TrackingNo.ToString()));
            SqlTransaction trans;
            SqlConnection  conn    = Connection.getConnection();
            bool           isSaved = false;

            trans = conn.BeginTransaction();
            try
            {
                SamplingResultBLL obj = new SamplingResultBLL();
                obj = obj.GetSamplingResultById(this.SamplingResultId);


                //Tod Do if the code is from Regrading then the Tracking Number should change.
                string TranNoGradedispute = "";
                TranNoGradedispute = TrackingNo;
                //if not from regrading.


                if (TranNoGradedispute == "")
                {
                    throw new Exception("Unable to get Tracking Number.");
                }


                this.Id          = Guid.NewGuid();
                this.GradingCode = GetRandomCode(WarehouseNo);
                // TODO - Complete Work flow intgeration.
                //this.TrackingNo = TranNoGradedispute;


                this.TrackingNo = TrackingNo;
                isSaved         = GradingDAL.InsertGrading(this, trans);

                if (isSaved == true)
                {
                    // add Graders.
                    GradingByBLL objGradingBy = new GradingByBLL();
                    isSaved = objGradingBy.Add(this.Id, list, trans);
                    if (isSaved == false)
                    {
                        throw new CodeGenerationException("Can Not generarte Grading Code Exception");
                    }
                    else
                    {
                        int           at    = -1;
                        AuditTrailBLL objAt = new AuditTrailBLL();
                        at = objAt.saveAuditTrail(this, WFStepName.GenerateGradingCode.ToString(), UserBLL.GetCurrentUser(), "Get Grading Code");
                        if (at == 1)
                        {
                            isSaved = true;
                        }
                        else
                        {
                            isSaved = false;
                        }
                    }
                }
                else
                {
                    throw new CodeGenerationException("Can Not generarte Grading Code Exception");
                }



                if (isSaved == true)
                {
                    HttpContext.Current.Session["msg"] = WFTransaction.Request(TrackingNo);
                    WFTransaction.WorkFlowManager(TrackingNo);
                    trans.Commit();
                }
                return(isSaved);
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                trans.Dispose();
                conn.Close();
            }
        }
Пример #9
0
        public static void LoadVariables(string msg, string TrackingNo)
        {
            TrackingNo = TrackingNo.Trim();
            if (msg.Trim() == WFStepsName.AddDriverInformation.ToString())
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TrackingNo);
                if (objCDR != null)
                {
                    HttpContext.Current.Session["CommodityRequestId"] = objCDR.Id;
                }
                else
                {
                    throw new Exception("Can't load page variables,please try again.");
                }
            }
            else if (msg.Trim() == WFStepsName.AddVoucherInfo.ToString())
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TrackingNo);
                if (objCDR != null)
                {
                    HttpContext.Current.Session["CommodityRequestId"] = objCDR.Id;
                }
                else
                {
                    throw new Exception("Can't load page variables,please try again.");
                }
            }
            else if (msg.Trim() == WFStepsName.AddDriverInformation.ToString())
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TrackingNo);
                if (objCDR != null)
                {
                    HttpContext.Current.Session["CommodityRequestId"] = objCDR.Id;
                }
                else
                {
                    throw new Exception("Can't load page variables,please try again.");
                }
            }
            else if (msg.Trim() == WFStepsName.AddVoucherInfo.ToString())
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TrackingNo);
                if (objCDR != null)
                {
                    HttpContext.Current.Session["CommodityRequestId"] = objCDR.Id;
                }
                else
                {
                    throw new Exception("Can't load page variables,please try again.");
                }
            }
            else if (msg.Trim() == WFStepsName.GetSampleTicket.ToString())
            {
            }
            else if (msg.Trim() == WFStepsName.AddSamplingResult.ToString())
            {
                List <SamplingBLL> list = new List <SamplingBLL>();
                SamplingBLL        obj  = new SamplingBLL();
                list = obj.GetSamplesPenndingResultByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        obj = list[0];
                        HttpContext.Current.Session["SamplingReasultAddId"] = obj.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.AddSampleCoding.ToString())
            {
                //SamplingResultBLL obj = new SamplingResultBLL();
                //obj = obj.GetSamplesResultsPendingCodingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                //if (obj != null)
                //{
                //    if (string.IsNullOrEmpty(obj.TrackingNo) != true)
                //    {

                //        HttpContext.Current.Session["GenerateCodeSampleId"] = obj.Id;
                //    }
                //    else
                //    {
                //        throw new Exception("Unable to get Record");
                //    }

                //}
                SamplingResultBLL objGrading = new SamplingResultBLL();

                objGrading = objGrading.GetSamplesResultsPendingCodingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (objGrading != null)
                {
                    if (string.IsNullOrEmpty(objGrading.TrackingNo) != true)
                    {
                        HttpContext.Current.Session["GradingCodeId"] = objGrading.SamplingResultCode;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.GenerateGradingCode.ToString())
            {
                SamplingResultBLL objGrading = new SamplingResultBLL();

                objGrading = objGrading.GetSamplesResultsPendingCodingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (objGrading != null)
                {
                    if (string.IsNullOrEmpty(objGrading.TrackingNo) != true)
                    {
                        HttpContext.Current.Session["GradingCodeId"]         = objGrading.SamplingResultCode;
                        HttpContext.Current.Session["GradingCodeTrackingNo"] = TrackingNo.ToString();
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.CodeSampRec.ToString())
            {
                GradingBLL        objGrading = new GradingBLL();
                List <GradingBLL> list       = new List <GradingBLL>();
                list = objGrading.GetGradingsPendingCodeReceivingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["CodeSampleRecivedGradingId"] = objGrading.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.AddGradingResult.ToString())
            {
                GradingBLL        objGrading = new GradingBLL();
                List <GradingBLL> list       = new List <GradingBLL>();
                list = objGrading.GetGradingsPendingResultByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["GradingRecivedGradingId"] = objGrading.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.GradingResultCA.ToString())
            {
                GradingResultBLL objGrading = new GradingResultBLL();
                objGrading = objGrading.GetGradingResultByTrackingNo(TrackingNo);
                if (objGrading != null)
                {
                    if (objGrading.ID != null)
                    {
                        HttpContext.Current.Session["GRID"] = objGrading.ID;
                    }
                }
            }

            else if (msg.Trim() == WFStepsName.PreWeighTruck.ToString())
            {
                GradingResultBLL        objGrading = new GradingResultBLL();
                List <GradingResultBLL> list       = new List <GradingResultBLL>();
                list = objGrading.GetAcceptedresultsPendingUnloadingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["AddUnLoadingId"]            = objGrading.ID;
                        HttpContext.Current.Session["AddUnLoadingIdGradingCode"] = objGrading.GradingCode;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.AddUnloadingInfo.ToString())
            {
                GradingResultBLL        objGrading = new GradingResultBLL();
                List <GradingResultBLL> list       = new List <GradingResultBLL>();
                list = objGrading.GetAcceptedresultsPendingUnloadingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["AddUnLoadingId"]            = objGrading.ID;
                        HttpContext.Current.Session["AddUnLoadingIdGradingCode"] = objGrading.GradingCode;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.PostWeighTruck.ToString())
            {
                GradingResultBLL        objGrading = new GradingResultBLL();
                List <GradingResultBLL> list       = new List <GradingResultBLL>();
                list = objGrading.GetAcceptedresultsPendingScalingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["AddScalingGradingCode"] = objGrading.GradingCode;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.AddScalingInfo.ToString())
            {
                GradingResultBLL        objGrading = new GradingResultBLL();
                List <GradingResultBLL> list       = new List <GradingResultBLL>();
                list = objGrading.GetAcceptedresultsPendingScalingByTrackingNo(UserBLL.GetCurrentWarehouse(), TrackingNo);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        objGrading = list[0];
                        HttpContext.Current.Session["AddScalingGradingCode"] = objGrading.GradingCode;
                    }
                }
            }
            // ADD GRN
            else if (msg.Trim() == WFStepsName.AddGRN.ToString())
            {
                GradingResultBLL objGrading = new GradingResultBLL();
                objGrading = objGrading.GetGradingResultByTrackingNo(TrackingNo);
                if (objGrading != null)
                {
                    if (objGrading.ID != null)
                    {
                        HttpContext.Current.Session["GRNID"] = TrackingNo; // objGrading.ID;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.GRNAcceptance.ToString())
            {
                GRNBLL objGRN = new GRNBLL();
                objGRN = objGRN.GetbyByTrackingNo(TrackingNo);
                if (objGRN != null)
                {
                    if (objGRN.Id != null)
                    {
                        HttpContext.Current.Session["GRNID"] = objGRN.Id;
                    }
                    else
                    {
                        throw new Exception("Invalid GRN Id");
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.ClientAcceptance.ToString())
            {
                RequestforEditGRNBLL objGRN = new RequestforEditGRNBLL();
                objGRN = objGRN.GetByTrackingNo(TrackingNo);
                if (objGRN != null)
                {
                    if (objGRN.Id != null)
                    {
                        HttpContext.Current.Session["GRNID"] = objGRN.GRNId;
                    }
                    else
                    {
                        throw new Exception("Invalid GRN Id");
                    }
                }
            }
            //Update GRN
            else if (msg.Trim() == WFStepsName.UpdateGRNNo.ToString())
            {
                GRNBLL objGRN = new GRNBLL();
                objGRN = objGRN.GetbyByTrackingNo(TrackingNo);
                if (objGRN != null)
                {
                    if (objGRN.GRN_Number != null)
                    {
                        HttpContext.Current.Session["GRNIDUpdateGRNNo"]      = objGRN.Id;
                        HttpContext.Current.Session["TrackingNoUpdateGRNNo"] = TrackingNo;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.EditGRN.ToString())
            {
                GRNBLL objGRN = new GRNBLL();
                objGRN = objGRN.GetbyByTrackingNo(TrackingNo);
                if (objGRN != null)
                {
                    if (objGRN.GRN_Number != null)
                    {
                        HttpContext.Current.Session["GRNID"]         = objGRN.Id;
                        HttpContext.Current.Session["GRNTrackingNo"] = TrackingNo;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.WarehouseManagerAppr.ToString())
            {
                RequestforEditGRNBLL objGRN = new RequestforEditGRNBLL();
                objGRN = objGRN.GetByTrackingNo(TrackingNo);
                if (objGRN != null)
                {
                    if (objGRN.Id != null)
                    {
                        HttpContext.Current.Session["GRNID"]         = objGRN.GRNId;
                        HttpContext.Current.Session["GRNTrackingNo"] = TrackingNo;
                    }
                    else
                    {
                        throw new Exception("Invalid GRN Id");
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.EditGradeDispute.ToString())
            {
                GradingDisputeBLL objGradeDispute = new GradingDisputeBLL();
                objGradeDispute = objGradeDispute.GetByTransactionNo(TrackingNo);
                if (objGradeDispute != null)
                {
                    if (objGradeDispute.Id != null)
                    {
                        HttpContext.Current.Session["EditGradeDisputeId"] = objGradeDispute.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.ApproveReSampling.ToString())
            {
                ReSamplingBLL objReSampling = new ReSamplingBLL();
                objReSampling = objReSampling.GetByTrackingNo(TrackingNo);
                if (objReSampling != null)
                {
                    if (objReSampling.Id != null)
                    {
                        HttpContext.Current.Session["ResamplingEdit"] = objReSampling.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.WHAppGRNEdit.ToString())
            {
                RequestforEditGRNBLL obj = new RequestforEditGRNBLL();
                obj = obj.GetByTrackingNo(TrackingNo);
                if (obj != null)
                {
                    if (obj.Id != null)
                    {
                        HttpContext.Current.Session["GRNEditRequestId"] = obj.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.OpenGRNForEdit.ToString())
            {
                RequestforEditGRNBLL obj = new RequestforEditGRNBLL();
                obj = obj.GetByTrackingNo(TrackingNo);
                if (obj != null)
                {
                    if (obj.Id != null)
                    {
                        HttpContext.Current.Session["OpenGRNEditId"] = obj.Id;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.EditWHR.ToString().Trim())
            {
                RequestforEditGRNBLL obj = new RequestforEditGRNBLL();
                obj = obj.GetByTrackingNo(TrackingNo);
                if (obj != null)
                {
                    if (obj.GRNId != null)
                    {
                        HttpContext.Current.Session["ReCreateGRNID"]         = obj.GRNId;
                        HttpContext.Current.Session["ReCreateGRNTrackingNo"] = TrackingNo;
                    }
                }
            }
            else if (msg.Trim() == "ApproveCancelationRequest".ToString().Trim() || (msg.Trim() == "CancelGRN"))
            {
                RequestforApprovedGRNCancelationBLL obj = new RequestforApprovedGRNCancelationBLL();
                obj = obj.GetByTrackingNo(TrackingNo);
                if (obj != null)
                {
                    if (obj.GRNId != null)
                    {
                        HttpContext.Current.Session["CancelGRNTrackingNo"] = TrackingNo;
                        HttpContext.Current.Session["GRNID"] = obj.GRNId;
                    }
                }
            }
            else if (msg.Trim() == WFStepsName.EditGradingResult.ToString().Trim())
            {
                GradingResultBLL objGradingResult = new GradingResultBLL();
                HttpContext.Current.Session["GRID"] = null;
                objGradingResult = objGradingResult.GetGradingResultByTrackingNo(TrackingNo.Trim());
                if (objGradingResult != null)
                {
                    HttpContext.Current.Session["GRID"] = objGradingResult.ID.ToString();
                }
                else
                {
                    objGradingResult = new GradingResultBLL();
                    objGradingResult = objGradingResult.GetGradingResultByTrackingNoForGradeDispute(TrackingNo.Trim());
                    if (objGradingResult != null)
                    {
                        HttpContext.Current.Session["GRID"] = objGradingResult.ID.ToString();
                    }
                }
            }
            else if (msg.Trim() == "UpdateClientNo")
            {
                //NoClient
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TrackingNo);
                if (objCDR != null)
                {
                    HttpContext.Current.Session["CommodityRequestId"] = objCDR.Id;
                }
                else
                {
                    throw new Exception("Can't load page variables,please try again.");
                }
            }
        }