Exemplo n.º 1
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.");
                }
            }
        }