Esempio n. 1
0
        public GradingResultBLL GetClientRejectedGradingResultByGradingId(Guid Id)
        {
            GradingResultBLL obj = new GradingResultBLL();

            try
            {
                obj = GradingResultDAL.GetClientRejectedGradingResultByGradingId(Id);
                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public GradingResultBLL GetApprovedGradingResultByCommdityDepositerequest(Guid Id)
        {
            GradingResultBLL obj = new GradingResultBLL();

            try
            {
                obj = GradingResultDAL.GetApprovedGradingResultByCommdityDepositerequest(Id);
                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public GradingResultBLL GetGradingResultById(Guid Id, SqlTransaction tran)
        {
            GradingResultBLL obj = new GradingResultBLL();

            try
            {
                obj = GradingResultDAL.GetGradingResultById(Id, tran);
                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Grade Dispute
        /// </summary>
        /// <param name="TrackingNo"></param>
        /// <returns></returns>
        public GradingResultBLL GetGradingResultByTrackingNoForGradeDispute(string TrackingNo)
        {
            GradingResultBLL obj = new GradingResultBLL();

            try
            {
                obj = GradingResultDAL.GetGradingResultByTrackingNoForGradeDispute(TrackingNo);
                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
 public GradingResultBLL(GradingResultBLL source)
 {
     this._id                    = source._id;
     this._gradingId             = source._gradingId;
     this._commodityGradeId      = source._commodityGradeId;
     this._status                = source._status;
     this._remark                = source._remark;
     this._gradeRecivedTimestamp = source._gradeRecivedTimestamp;
     this._isSupervisor          = source._isSupervisor;
     this.CreatedBy              = source.CreatedBy;
     this.CreatedTimestamp       = source.CreatedTimestamp;
     this.LastModifiedBy         = source.LastModifiedBy;
     this.LastModifiedTimestamp  = source.LastModifiedTimestamp;
 }
Esempio n. 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);
            }
        }
Esempio n. 7
0
        public bool ClientAcceptance(Guid Id, int Status, GradingResultStatus GradeRecivedStatatus, Nullable <DateTime> ClientAccpetedTimeStamp, out string strQueueNo)
        {
            DateTime         dt;
            GradingResultBLL objUpdate = new GradingResultBLL();

            objUpdate.ID     = Id;
            objUpdate.Status = (GradingResultStatus)Status;
            try
            {
                dt = (DateTime)ClientAccpetedTimeStamp;
            }
            catch
            {
                throw new Exception("Invalid Client Acceptance Date.");
            }
            objUpdate.ClientAcceptanceTimeStamp = ClientAccpetedTimeStamp;
            // Get Queue No.
            DateTime currDate         = DateTime.Today;
            Guid     WarehouseId      = UserBLL.GetCurrentWarehouse();
            string   Code             = currDate.Day.ToString() + currDate.Year.ToString().Substring(2, 2);
            int?     QueueNo          = null;
            int?     PreWeightQueueNo = null;

            try
            {
                GradingResultDAL.GetQueueNumber(Code, WarehouseId, currDate, out QueueNo, out PreWeightQueueNo);
                if (QueueNo == null || PreWeightQueueNo == null)
                {
                    throw new Exception("Can not get queue number");
                }
            }
            catch
            {
                new Exception("Can not get queue number.");
            }
            objUpdate.QueueDate        = currDate;
            objUpdate.QueueNo          = (int)QueueNo;
            strQueueNo                 = PreWeightQueueNo.ToString();
            objUpdate.PreWeightQueueNo = (int)PreWeightQueueNo;



            bool           isSaved = false;
            SqlTransaction tran;
            SqlConnection  conn = Connection.getConnection();

            tran = conn.BeginTransaction();
            GradingResultBLL objGradingResult = new GradingResultBLL();

            objGradingResult = objGradingResult.GetGradingResultById(Id, tran);
            AuditTrailBLL objAt = new AuditTrailBLL();
            int           At    = -1;

            try
            {
                isSaved = GradingResultDAL.ClientAcceptanceGradingResult(objUpdate, tran);
                if (objAt.saveAuditTrail(objGradingResult, objUpdate, WFStepsName.ClientAcceptance.ToString(), UserBLL.GetCurrentUser(), "Grading Result Client Respose") == 1)
                {
                    isSaved = true;
                    At      = 1;
                }

                string TranNo;
                TranNo = objGradingResult.TrackingNo;
                if (string.IsNullOrEmpty(TranNo) == true)
                {
                    tran.Rollback();
                    if (At == 1)
                    {
                        objAt.RoleBack();
                    }
                    isSaved = false;
                }
                else
                {
                    if ((int)GradingResultStatus.ClientAccepted == Status && (GradeRecivedStatatus == GradingResultStatus.New || GradeRecivedStatatus == GradingResultStatus.Approved))
                    {
                        WFTransaction.WorkFlowManager(TranNo);
                        HttpContext.Current.Session["CATranNo"] = TranNo;
                    }
                    else
                    {
                        WFTransaction.Close(TranNo);
                        //Create a new Grading Dispute task or General reqiurment fail.
                    }
                }
                if (isSaved == true)
                {
                    tran.Commit();
                    return(true);
                }
                else
                {
                    tran.Rollback();
                    objAt.RoleBack();
                    HttpContext.Current.Session["CATranNo"] = null;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                if (At == 1)
                {
                    objAt.RoleBack();
                }
                throw ex;
            }
            finally
            {
                tran.Dispose();
                conn.Close();
            }
        }
Esempio n. 8
0
        public bool UpdateGradingResult(List <GradingResultDetailBLL> list, Nullable <Guid> Id, string TrackingNo)
        {
            bool isSaved = false;


            SqlConnection  conn = Connection.getConnection();
            SqlTransaction tran = conn.BeginTransaction();

            this.WarehouseId = UserBLL.GetCurrentWarehouse();


            if (Id != null)
            {
                try
                {
                    this.ID = (Guid)Id;
                    if (GradingResultDAL.InactivateGradingResultDetails(this.ID, tran) == true)
                    {
                        int           at     = -1;
                        AuditTrailBLL objAt  = new AuditTrailBLL();
                        string        strNew = "(Grading Result Id -" + this.ID.ToString() + "),(LastModifiedby-" + UserBLL.GetCurrentUser().ToString() + "),(LastModifiedTimeStamp-" + DateTime.Now.ToString() + ")";
                        at = objAt.saveAuditTrailStringFormat("Grading Factor Details Cancelled", strNew, WFStepsName.EditGradingResultDet.ToString(), UserBLL.GetCurrentUser(), "Cancel Grading Result Detail");
                        if (at == -1)
                        {
                            tran.Rollback();
                            isSaved = false;
                        }
                        else
                        {
                            GradingResultBLL objGR = new GradingResultBLL();
                            objGR = objGR.GetGradingResultById(this.ID);
                            if (GradingResultDAL.UpdateGradingResult(this, tran) == true)
                            {
                                AuditTrailBLL objAtGR = new AuditTrailBLL();
                                at = objAtGR.saveAuditTrail(objGR, this, WFStepsName.EditGradingResult.ToString(), UserBLL.GetCurrentUser(), "Updating Grading Result");
                                if (at == -1)
                                {
                                    tran.Rollback();
                                    isSaved = false;
                                    return(isSaved);
                                }
                                GradingResultDetailBLL objDetail = new GradingResultDetailBLL();
                                isSaved = objDetail.Add(list, tran, Id);
                                if (isSaved == true)
                                {
                                    //Request
                                    ECXWF.CMessage msg = WFTransaction.Request(TrackingNo);
                                    if (msg != null)
                                    {
                                        if (msg.Name == "EditGradingResult")
                                        {
                                            WFTransaction.WorkFlowManager(TrackingNo, msg);
                                        }
                                    }
                                }


                                if (isSaved == false)
                                {
                                    tran.Rollback();
                                    isSaved = false;
                                }
                                else
                                {
                                    tran.Commit();
                                    isSaved = true;
                                }
                            }
                            else
                            {
                                tran.Rollback();
                                isSaved = false;
                            }
                        }
                    }
                    else
                    {
                        tran.Rollback();
                        isSaved = false;
                    }
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
                finally
                {
                    tran.Dispose();
                    conn.Close();
                }
            }

            return(isSaved);
        }
Esempio n. 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.");
                }
            }
        }