예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string exceptionMessage = string.Empty;
            string message          = string.Empty;

            this.Master.Reset();

            this.Master.RegisterStandardScript = true;

            if (!IsPostBack)
            {
                message    = "Scan action barcode";
                step.Value = AttachCageStep.ActionBarcodeScan.ToString();
            }
            else
            {
                CagingDAO cagingdao = new CagingDAO();
                string    barcode   = this.Master.BarcodeValue;
                switch (step.Value)
                {
                case "ActionBarcodeScan":
                {
                    try
                    {
                        CageAction action = CageAction.CageAttach;
                        int        laneID = 0;
                        cagingdao.determineCageAction(ref action, ref laneID, barcode, User.Identity.Name);
                        ViewState["laneID"] = laneID;
                        ViewState["action"] = action;
                        if (action == CageAction.CageTypeEnd)
                        {
                            try
                            {
                                cagingdao.endBarcodeScanned(laneID, User.Identity.Name);
                                message = "Scan action barcode";
                            }
                            catch (Exception ex)
                            {
                                exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    this.Master.ErrorMessage   = exceptionMessage;
                                    this.Master.DisplayMessage = true;
                                }
                                else
                                {
                                    message = exceptionMessage + ". Scan action barcode";
                                }
                            }
                            step.Value = AttachCageStep.ActionBarcodeScan.ToString();
                        }
                        else
                        {
                            step.Value = AttachCageStep.CageBarcodeScan.ToString();
                            message    = "Scan Cage to " + ((action == CageAction.CageAttach) ? "Attach" : "Detach");
                        }
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                        else
                        {
                            message = exceptionMessage;
                        }
                    }
                }
                break;


                case "CageBarcodeScan":
                {
                    int        laneID = (int)ViewState["laneID"];
                    CageAction action = (CageAction)ViewState["action"];
                    int        cageID = 0;
                    try
                    {
                        cageID = cagingdao.getCageIdForBarcode(barcode, User.Identity.Name);

                        if (action == CageAction.CageAttach)
                        {
                            cagingdao.attachCage(cageID, laneID, User.Identity.Name);
                        }
                        else if (action == CageAction.CageDetach)
                        {
                            cagingdao.detachCage(cageID, laneID, User.Identity.Name);
                        }
                        step.Value = AttachCageStep.ActionBarcodeScan.ToString();
                        message    = ((action == CageAction.CageAttach) ? "Attached" : "Detached") + ": Scan action barcode";
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                        else
                        {
                            message = exceptionMessage;
                        }
                        message    = "Scan action barcode";
                        step.Value = AttachCageStep.ActionBarcodeScan.ToString();
                        break;
                    }
                    break;
                }
                }
            }

            this.Master.MessageBoard = message; // +"    " + step.Value;
            this.Master.BarcodeValue = string.Empty;
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string exceptionMessage = string.Empty;
            string message          = string.Empty;

            this.Master.Reset();

            this.Master.RegisterStandardScript = true;

            if (!IsPostBack)
            {
                message    = "Scan Parcel";
                step.Value = ManualCageStep.ParcelBarcodeScan.ToString();
            }
            else
            {
                CagingDAO cagingdao = new CagingDAO();
                string    barcode   = this.Master.BarcodeValue;

                switch (step.Value)
                {
                case "ParcelBarcodeScan":
                {
                    try
                    {
                        int parcelID = cagingdao.getParcelIdForBarcode(barcode, User.Identity.Name);
                        ViewState["parcelID"] = parcelID;
                        try
                        {
                            cagingdao.parcelDestination(parcelID);
                        }
                        catch (Exception ex)
                        {
                            exceptionMessage = ex.Message;
                            if (isErrorMessage(ref exceptionMessage))
                            {
                                this.Master.ErrorMessage   = exceptionMessage;
                                this.Master.DisplayMessage = true;
                                message = "Scan Parcel";
                            }

                            else
                            {
                                message = exceptionMessage + "</br>";
                                // if caged already then just display message cage and expect parcel scan
                                string sMsg     = "PARCEL CAGED IN";
                                int    strlngth = sMsg.Length;
                                if (message.ToUpper().Substring(0, strlngth) == sMsg)
                                {
                                    message   += "Scan Parcel";
                                    step.Value = ManualCageStep.ParcelBarcodeScan.ToString();
                                }
                                else
                                {
                                    message   += "Scan Cage";
                                    step.Value = ManualCageStep.CageBarcodeScan.ToString();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                        else
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                        message = "Scan Parcel";
                    }
                }
                break;


                case "CageBarcodeScan":
                {
                    int parcelID = (int)ViewState["parcelID"];
                    try
                    {
                        int cageID = cagingdao.getCageIdForBarcode(barcode, User.Identity.Name);

                        try
                        {
                            cagingdao.manualScanToCage(parcelID, cageID, User.Identity.Name);
                            step.Value = ManualCageStep.ParcelBarcodeScan.ToString();
                            message    = "Parcel Caged.</br>";
                            message   += "Scan new parcel";
                        }
                        catch (Exception ex)
                        {
                            exceptionMessage = ex.Message;
                            if (isErrorMessage(ref exceptionMessage))
                            {
                                this.Master.ErrorMessage   = exceptionMessage;
                                this.Master.DisplayMessage = true;
                                //message = "Scan Cage";
                            }
                            else
                            {
                                message    = exceptionMessage + ". Scan new parcel";
                                step.Value = ManualCageStep.ParcelBarcodeScan.ToString();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                            message = "Scan Cage";
                        }
                        else
                        {
                            message = exceptionMessage = ". Scan Cage";
                        }
                        break;
                    }
                    break;
                }
                }
            }
            this.Master.MessageBoard = message;
            this.Master.BarcodeValue = string.Empty;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string exceptionMessage = string.Empty;
            string message          = string.Empty;

            this.Master.Reset();

            this.Master.RegisterStandardScript = true;

            if (!IsPostBack)
            {
                message    = "Scan Cage";
                step.Value = RemoveCageStep.CageBarcodeScan.ToString();
            }
            else
            {
                CagingDAO cagingdao = new CagingDAO();
                string    barcode   = this.Master.BarcodeValue;

                switch (step.Value)
                {
                case "CageBarcodeScan":
                {
                    try
                    {
                        int cageID = cagingdao.getCageIdForBarcode(barcode, User.Identity.Name);
                        ViewState["cageID"] = cageID;
                        message             = "Scan Parcel";
                        step.Value          = RemoveCageStep.ParcelBarcodeScan.ToString();
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                        else
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                        }
                    }
                }
                break;


                case "ParcelBarcodeScan":
                {
                    int cageID = (int)ViewState["cageID"];
                    try
                    {
                        int parcelID = cagingdao.getParcelIdForBarcode(barcode, User.Identity.Name);

                        try
                        {
                            int ordernumber = 0;
                            int packCount   = 0;
                            cagingdao.removeFromCage(ref ordernumber, ref packCount, cageID, parcelID, User.Identity.Name);
                            step.Value = RemoveCageStep.CageBarcodeScan.ToString();
                            if (packCount > 0)
                            {
                                message  = packCount.ToString() + " package(s), Order: " + ordernumber.ToString() + " still caged.";
                                message += " Parcel Removed. Scan Cage";
                            }
                            else
                            {
                                message = "Parcel Removed. Scan Cage.";
                            }
                        }
                        catch (Exception ex)
                        {
                            exceptionMessage = ex.Message;
                            if (isErrorMessage(ref exceptionMessage))
                            {
                                this.Master.ErrorMessage   = exceptionMessage;
                                this.Master.DisplayMessage = true;
                                message = "Scan Parcel";
                            }
                            else
                            {
                                message = exceptionMessage;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        exceptionMessage = ex.Message;
                        if (isErrorMessage(ref exceptionMessage))
                        {
                            this.Master.ErrorMessage   = exceptionMessage;
                            this.Master.DisplayMessage = true;
                            message = "Scan Parcel";
                        }
                        else
                        {
                            message = exceptionMessage + ". Scan Parcel";
                        }
                        break;
                    }
                    break;
                }
                }
            }
            this.Master.MessageBoard = message;
            this.Master.BarcodeValue = string.Empty;
        }