Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            if (!session.LoginAccepted)
            {
                Response.Redirect("~/Denied.aspx");
            }
            else
            {
                //if (!Page.IsPostBack)
                //{
                Call call = new Call();

                maxParts = int.Parse(ConfigUtils.GetAppSetting("maxParts", 10));

                if (session.Data.ContainsKey("call"))
                {
                    session.Data["call"] = call;
                }
                else
                {
                    session.Data.Add("call", call);
                }
                SiteSessionFactory.SaveSession(this.Page, session);
                //}

                orderPartsBLL.List = BindOrderParts(session.Login.SaediId);
                orderPartsBLL.List.Reverse();
                partsOrderGridView.DataBind();
                // SetButton();
            }
        }
Exemple #2
0
        protected void todayButton_Click(object sender, ImageClickEventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            session.Params.Clear();
            session.Params.Add("type", "date");
            session.Params.Add("date", DateTime.Today.ToString());
            SiteSessionFactory.SaveSession(this.Page, session);
            Response.Redirect("~/CallList.aspx");
        }
Exemple #3
0
        protected void orderLinkButton_Click(object sender, EventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            session.Data.Remove("StockAddSearch");
            session.Data.Remove("PartStockNote");
            session.Data.Add("PartStockNote", true);
            SiteSessionFactory.SaveSession(this.Page, session);

            Response.Redirect("~/PartSearch.aspx");
        }
Exemple #4
0
        protected void nextButton_Click(object sender, ImageClickEventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);
            DateTime    saved   = DateTime.Parse(session.Params["date"]);

            session.Params.Clear();
            session.Params.Add("type", "date");
            session.Params.Add("date", saved.AddDays(+1).ToString());
            SiteSessionFactory.SaveSession(this.Page, session);
            Response.Redirect("~/CallList.aspx");
        }
Exemple #5
0
        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            TxtSonNumber.Text = string.Empty;
            TxtStockCode.Text = string.Empty;
            TxtStockDesc.Text = string.Empty;

            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            orderPartsBLL.List = BindOrderParts(session.Login.SaediId);
            orderPartsBLL.List.Reverse();
            partsOrderGridView.DataBind();
        }
Exemple #6
0
        protected void partsOrderGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string        son                 = (string)DataBinder.Eval(e.Row.DataItem, "OrderReference");
                List <RMARef> result              = orderPartsBLL.GetPartsRMADetails(son, session.Login.SaediId);
                StringBuilder returnResult        = new StringBuilder();
                StringBuilder returnCourierResult = new StringBuilder();
                LinkButton    BtnBookCourier      = (LinkButton)(e.Row.FindControl("BtnBookCourier"));
                foreach (RMARef item in result)
                {
                    if (!string.IsNullOrEmpty(item.rmaDocumentUrl) && string.IsNullOrEmpty(item.Collectionref))
                    {
                        BtnBookCourier.Visible         = true;
                        BtnBookCourier.CommandArgument = string.IsNullOrEmpty(BtnBookCourier.CommandArgument) ? item.rmaId : BtnBookCourier.CommandArgument + "," + item.rmaId;
                    }
                    returnResult.AppendFormat("{3}. Return Ref: {1} ;{2}<br/> <a href='{0}' target='_blank' style='{4}'>Show RMA Document</a><br/>", item.rmaDocumentUrl, item.rmaId, item.shipmentStatus, (result.IndexOf(item)) + 1, string.IsNullOrEmpty(item.rmaDocumentUrl)? "visibility: hidden":"");
                    if (!string.IsNullOrEmpty(item.Collectionref))
                    {
                        if (!string.IsNullOrEmpty(item.CollectionDate))
                        {
                            returnCourierResult.AppendFormat(" Collection Ref : {0}  {1} <br/>", item.Collectionref, item.CollectionDate);
                        }
                        else //New Shipmate (CollectionDate is not set)
                        {
                            returnCourierResult.AppendFormat(" Collection Ref : {0}<br/>", item.Collectionref);
                            returnCourierResult.AppendFormat(" <a href='PartStock.aspx?ShowConsignmentDetails={0}'>Show consignment details</a> <br/>", item.Collectionref);
                            Mobile.Portal.BLL.Shipmate.Shipmate s = new Mobile.Portal.BLL.Shipmate.Shipmate();
                            returnCourierResult.AppendFormat(" <a href='{0}{1}' target='_blank'>Track</a> <br/>", s.GetCarrierTrackAndTraceUrl(item.Collectionref), item.Collectionref);
                            returnCourierResult.AppendFormat(" <a href='{0}' target='_blank'>Show courier label</a> <br/>", item.ShipmateMediaURL);
                        }
                    }
                }
                Label lbl = (Label)(e.Row.FindControl("ReturnDetails"));
                Label lblCourierDetails = (Label)(e.Row.FindControl("CourierDetails"));
                lbl.Text = returnResult.ToString();
                lblCourierDetails.Text = returnCourierResult.ToString();
            }
            //    List<CallPart> partsResult= orderPartsBLL.GetPartsByClientId(_id);
            //    foreach(  CallPart part in  partsResult)
            //    {
            //        List<RMARef> result = _RMAdal.GetPartsRMADetails(part.OrderReference, _id);
            //        part.RmaDetails = result;
            //    }
            //ReturnDetails
        }
Exemple #7
0
        //private void SetButton()
        //{
        //    CallPart part = orderPartsBLL.List.Find(delegate(CallPart cp) { return cp.PartReference.ToString() == partReturnButton.CommandArgument.ToString(); });

        //    string partDescription;
        //    try
        //    {
        //        partDescription = part.ReturnDescription;
        //    }
        //    catch
        //    {
        //        partDescription = string.Empty;
        //    }
        //    partReturnButton.Enabled = (part != null && part.ReturnRequired) || (partDescription != string.Empty); // added peter 15.04.2013
        //}

        protected void partsOrderGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                partReturnButton.CommandArgument = e.CommandArgument.ToString();
                // SetButton();
            }

            else if (e.CommandName == "BookCourier")
            {
                SiteSession session     = SiteSessionFactory.LoadSession(this.Page);
                string      rmaId       = e.CommandArgument.ToString();
                string      queryString = string.Format("ShipmatePage.aspx?Title=Book Courier Collection&SaediFromId={0}&RmaId={1}&ClientRef=0", session.Login.SaediId, rmaId);
                Iframe.Attributes.Add("src", queryString);
                Iframe.ID = "ModalPopupExtender";
                ModalPopupExtender1.Show();
            }
        }
Exemple #8
0
        private void CallPartView(string commandArgument, List <CallPart> basket, PartAction editMode)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);
            CallPart    part    = basket.Find(f => f.PartReference.ToString() == commandArgument);

            if (part != null)
            {
                if (session.Data.ContainsKey("part"))
                {
                    session.Data["part"] = orderPartsBLL.Clone(part);
                }
                else
                {
                    session.Data.Add("part", orderPartsBLL.Clone(part));
                }
                SiteSessionFactory.SaveSession(this.Page, session);
                Response.Redirect("~/PartReturn.aspx?from=stock");
            }
        }
Exemple #9
0
        //private void SetButton()
        //{
        //    CallPart part = orderPartsBLL.List.Find(delegate(CallPart cp) { return cp.PartReference.ToString() == partReturnButton.CommandArgument.ToString(); });

        //    string partDescription;
        //    try
        //    {
        //        partDescription = part.ReturnDescription;
        //    }
        //    catch
        //    {
        //        partDescription = string.Empty;
        //    }
        //    partReturnButton.Enabled = (part != null && part.ReturnRequired) || (partDescription != string.Empty); // added peter 15.04.2013
        //}

        protected void partsOrderGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                partReturnButton.CommandArgument = e.CommandArgument.ToString();
                // SetButton();
            }

            else if (e.CommandName == "BookCourier")
            {
                SiteSession session = SiteSessionFactory.LoadSession(this.Page);

                string rmaId       = e.CommandArgument.ToString();
                string queryString = string.Format("Collectionjob.aspx?SAEDIID={0}&RMAList={1}&loop=true", session.Login.SaediId, rmaId);


                Iframe.Attributes.Add("src", queryString);

                ModalPopupExtender1.Show();
            }
        }
Exemple #10
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Page")
            {
                switch (e.CommandArgument.ToString())
                {
                case ("Last"): GridView1.PageIndex = 1000;
                    break;

                case ("First"): GridView1.PageIndex = 1;
                    break;

                case ("Next"): GridView1.PageIndex = GridView1.PageIndex + 1;
                    break;

                case ("Prev"): GridView1.PageIndex = GridView1.PageIndex - 1;
                    break;

                default:
                    int pageNo;
                    if (int.TryParse(e.CommandArgument.ToString(), out pageNo))
                    {
                        GridView1.PageIndex = pageNo;
                    }
                    break;
                }
            }
            else
            {
                int         id      = int.Parse(e.CommandArgument.ToString());
                Call        rowCall = callsBLL.GetById(id);
                SiteSession session = SiteSessionFactory.LoadSession(this.Page);

                if (rowCall.Instruction != 1 && !rowCall.IsSony)
                {
                    InspectionBLL inspectionsBLL = new InspectionBLL();
                    rowCall.hasInspections = inspectionsBLL.CallHasInspections(rowCall.SaediToId, rowCall.SaediFromId, rowCall.ClientRef);
                }

                if (session.Data.ContainsKey("call"))
                {
                    session.Data["call"] = rowCall;
                }
                else
                {
                    session.Data.Add("call", rowCall);
                }


                SiteSessionFactory.SaveSession(this.Page, session);
                if (rowCall.Instruction == 1)
                {
                    Response.Redirect("~/Accept.aspx");
                }
                else
                {
                    /////////////////////////// CHECK STOCK PARTS IN SAEDICALLS ////////////////////////////
                    // This should be added on add stock parts or Allocate part.
                    // Sometimes the proper part wasn't added (web service return different part!!??)
                    // We check the part here again:
                    ///////////////////////////////////////////////////////////////////////////////////////
                    //OSPRefBLL ospBLL = new OSPRefBLL();
                    //List<OSPRefs> ospRefsList = ospBLL.GetOSPRefByCallID(rowCall.Id.ToString());
                    //OSPRefs ospRefs = new OSPRefs();
                    //if (ospRefsList.Count > 0)
                    //    ospRefs = ospRefsList[0];
                    //else
                    //    ospRefs.StockAddSearch = "False";

                    //if (ospRefs.StockAddSearch == "True") // If it is SONY
                    //{
                    //    PartsBLL partsBLL = new PartsBLL();
                    //    PartsBLL stockPartsBLL = new PartsBLL();
                    //    PartsBLL allocatedPartsBLL = new PartsBLL();
                    //    PartsBLL partsAll = new PartsBLL();
                    //    PartsBLL partsOrdered = new PartsBLL();
                    //    PartsBLL SAEDIParts = new PartsBLL();

                    //    SAEDIParts.List = SAEDIParts.GetSAEDIPartsByCall(rowCall.SaediFromId, rowCall.ClientRef).ToList();
                    //    stockPartsBLL.List = partsBLL.GetPartsByClientIdForSONY(rowCall.Id.ToString(), rowCall.SaediFromId, rowCall.ClientRef).ToList();

                    //    try
                    //    { partsAll.List = partsBLL.GetPartsByCallId(rowCall.Id); }
                    //    catch { }
                    //    foreach (CallPart line in partsAll.List.ToList())
                    //    {
                    //        CallPart callPartAllocated = rowCall.UsedParts.Items.Find(p => p.Code == line.Code);
                    //        if (callPartAllocated != null && line.StatusID.ToUpper().Trim() != "V" && line.IsStock == false)
                    //        {
                    //            allocatedPartsBLL.List.Add(line);
                    //        }
                    //    }

                    //    try
                    //    {
                    //        // ---------------------------
                    //        // 1.) SYNCHRONISE SAEDICalls
                    //        // ---------------------------
                    //        rowCall.UsedParts.Items.Clear();
                    //        rowCall.UsedParts.Items.AddRange(stockPartsBLL.List.ToList());
                    //        rowCall.UsedParts.Items.AddRange(allocatedPartsBLL.List.ToList());
                    //        callsBLL.UpdateCall(rowCall);
                    //        session.Data["call"] = rowCall;
                    //        SiteSessionFactory.SaveSession(this.Page, session);

                    //        // --------------------------
                    //        // 2.) SYNCHRONISE SAEDIParts
                    //        // --------------------------
                    //        foreach (CallPart part in partsAll.List.ToList())
                    //        {
                    //            CallPart saediPart = SAEDIParts.List.ToList().Find(p => p.PartReference == part.PartReference && p.StatusID == part.StatusID);
                    //            bool IsSAEDIAllocated = false;
                    //            if (saediPart != null)
                    //                IsSAEDIAllocated = saediPart.IsAllocated;

                    //            if (IsSAEDIAllocated == false)
                    //            {
                    //                CallPart allocatedPart = allocatedPartsBLL.List.ToList().Find(p => p.PartReference == part.PartReference && p.StatusID == part.StatusID);
                    //                if (allocatedPart != null)
                    //                    part.IsAllocated = true;

                    //                part.SAEDIFromID = rowCall.SaediFromId;
                    //                part.SAEDICallRef = rowCall.ClientRef;

                    //                SAEDIParts.DeleteSAEDIPart(part);
                    //                SAEDIParts.InsertSAEDIPart(part);
                    //            }
                    //        }

                    //        foreach (CallPart part in SAEDIParts.List.ToList())
                    //        {
                    //            CallPart partExist = partsAll.List.ToList().Find(p => p.PartReference == part.PartReference && p.StatusID == part.StatusID);
                    //            if (partExist == null)
                    //                SAEDIParts.DeleteSAEDIPart(part);
                    //        }
                    //    }
                    //    catch { }
                    //}
                    //////////////////////////

                    Response.Redirect("~/Appointment.aspx");
                }
            }
        }
Exemple #11
0
        // Peter Test ------------------------
        protected void CallDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            e.InputParameters["saediId"] = session.Login.SaediId;

            // ------------------
            // SEARCH FROM NOTES:
            // ------------------
            if (Request.QueryString["callId"] != null)
            {
                try
                {
                    e.InputParameters["callId"]               = Request.QueryString["callId"].ToString();
                    e.InputParameters["postCode"]             = string.Empty;
                    e.InputParameters["surname"]              = string.Empty;
                    e.InputParameters["status"]               = "0";
                    e.InputParameters["importedTechnicianCD"] = string.Empty;
                    e.InputParameters["dateFrom"]             = DateTime.Now.AddYears(-5).ToString("dd/MM/yyyy");
                    e.InputParameters["dateTo"]               = DateTime.Now.AddYears(100).ToString("dd/MM/yyyy");
                    e.InputParameters["CaseId"]               = session.Params["CaseId"];
                }
                catch { }

                return;
            }

            if (Request.QueryString["ID"] != null)
            {
                try
                {
                    int statusID = int.Parse(Request.QueryString["ID"].ToString());
                    e.InputParameters["statusId"] = statusID;
                }
                catch
                {
                    Response.RedirectPermanent("~/Home.aspx");
                }

                return;
            }

            if (session.Params["type"] == "search")
            {
                e.InputParameters["callId"]   = session.Params["callId"];
                e.InputParameters["postCode"] = session.Params["postCode"];
                e.InputParameters["surname"]  = session.Params["surname"];
                e.InputParameters["status"]   = session.Params["status"];
                try
                {
                    e.InputParameters["importedTechnicianCD"] = session.Params["importedTechnicianCD"];
                }
                catch { }
                e.InputParameters["dateFrom"] = session.Params["dateFrom"];
                e.InputParameters["dateTo"]   = session.Params["dateTo"];

                e.InputParameters["CaseId"] = session.Params["CaseId"];
                return;
            }
            if (session.Params["type"] == "Reservationsearch")
            {
                e.InputParameters["ReservationId"] = session.Params["ReservationId"];

                return;
            }

            if (session.Params["type"] == "date")
            {
                e.InputParameters["thedate"] = DateTime.Parse(session.Params["date"]);
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteSession session = SiteSessionFactory.LoadSession(this.Page);

            session.Errors.Clear();
            SiteSessionFactory.SaveSession(this.Page, session);
            if (!session.LoginAccepted)
            {
                Response.Redirect("~/Denied.aspx");
            }
            else
            {
                if (session.Data.ContainsKey("call"))
                {
                    session.Data.Remove("call");
                }

                if (session.Data.ContainsKey("part"))
                {
                    session.Data.Remove("part");
                }

                if (session.Data.ContainsKey("search"))
                {
                    session.Data.Remove("search");
                }

                if (session.Data.ContainsKey("basket"))
                {
                    session.Data.Remove("basket");
                }

                callsBLL = new CallsBLL();

                try
                {
                    if (!Page.IsCallback)
                    {
                        GridView1.Columns[4].Visible = session.Device == "DESKTOP";
                        GridView1.Columns[2].Visible = session.Device == "DESKTOP";

                        GridView1.Columns[4].Visible = session.Login.OSPRef == "SONY3C";
                        GridView1.Columns[5].Visible = session.Login.OSPRef == "SONY3C";

                        // Test - Peter
                        // if (session.Params["type"] == "closed" ||
                        //     session.Params["type"] == "wip" ||
                        //     session.Params["type"] == "nodate" ||
                        //     session.Params["type"] == "new" ||
                        //     session.Params["type"] == "incomplete" ||
                        //     session.Params["type"] == "parts")
                        //     session.Params["type"] == "search")
                        // {
                        // Peter Test ----------------------------

                        CallDataSource.EnablePaging = true;
                        CallDataSource.SelectParameters.Clear();
                        CallDataSource.StartRowIndexParameterName = "startRowIndex";
                        CallDataSource.MaximumRowsParameterName   = "maxNumRows";
                        CallDataSource.SelectParameters.Add(new Parameter("saediId"));

                        if (Request.QueryString["ID"] != null)
                        {
                            if (Request.QueryString["ID"].Length > 3)
                            {
                                Response.RedirectPermanent("~/Home.aspx");
                            }

                            StatusBLL statusBLL = new StatusBLL();
                            try
                            {
                                int    statusID   = int.Parse(Request.QueryString["ID"].ToString());
                                string statusName = statusBLL.GetStatusName(statusID);
                                titleLabel.Text = " - " + statusName;
                            }
                            catch
                            {
                                Response.RedirectPermanent("~/Home.aspx");
                            }

                            dateLabel.Visible      = false;
                            previousButton.Visible = false;
                            nextButton.Visible     = false;
                            todayButton.Visible    = false;
                            calendarButton.Visible = false;

                            CallDataSource.SelectParameters.Add(new Parameter("statusId"));
                            session.Params.Remove("Chart-StatusID");

                            CallDataSource.SelectMethod      = "GetCallsByStatus";
                            CallDataSource.SelectCountMethod = "GetCallsByStatusCount";

                            return;
                        }

                        if (Request.QueryString["callId"] != null)
                        {
                            CallDataSource.SelectParameters.Add(new Parameter("callId"));

                            titleLabel.Text = " - Search Results";
                            // Test Peter: ---------------------------------
                            CallDataSource.SelectMethod      = "GetModelsBySearch";
                            CallDataSource.SelectCountMethod = "GetModelsBySearchCount";
                            // ---------------------------------------------
                            dateLabel.Visible      = false;
                            previousButton.Visible = false;
                            nextButton.Visible     = false;
                            todayButton.Visible    = false;
                            calendarButton.Visible = false;
                            return;
                        }

                        if (session.Params["type"] == "search")
                        {
                            CallDataSource.SelectParameters.Add(new Parameter("callId"));
                            CallDataSource.SelectParameters.Add(new Parameter("postCode"));
                            CallDataSource.SelectParameters.Add(new Parameter("surname"));
                            CallDataSource.SelectParameters.Add(new Parameter("status"));
                            CallDataSource.SelectParameters.Add(new Parameter("importedTechnicianCD"));
                            CallDataSource.SelectParameters.Add(new Parameter("dateFrom"));
                            CallDataSource.SelectParameters.Add(new Parameter("dateTo"));

                            CallDataSource.SelectParameters.Add(new Parameter("CaseId"));
                        }
                        if (session.Params["type"] == "Reservationsearch")
                        {
                            CallDataSource.SelectParameters.Add(new Parameter("ReservationId"));
                        }
                        // }
                        // ----------------------------------------

                        if (session.Params["type"] == "date")
                        {
                            DateTime saved = DateTime.Parse(session.Params["date"]);
                            titleLabel.Text        = " - Date";
                            dateLabel.Text         = saved.ToString("d");
                            dateLabel.Visible      = true;
                            previousButton.Visible = true;
                            nextButton.Visible     = true;
                            todayButton.Visible    = true;
                            calendarButton.Visible = true;

                            CallDataSource.SelectParameters.Add(new Parameter("thedate"));
                            // Test Peter: ---------------------------------
                            CallDataSource.SelectMethod      = "GetModelsByDate";
                            CallDataSource.SelectCountMethod = "GetModelsByDateCount";
                            // ---------------------------------------------
                            // callsBLL.List = callsBLL.GetModelsByDate(session.Login.SaediId, DateTime.Parse(session.Params["date"]));
                        }
                        else
                        {
                            dateLabel.Visible      = false;
                            previousButton.Visible = false;
                            nextButton.Visible     = false;
                            todayButton.Visible    = false;
                            calendarButton.Visible = false;

                            if (session.Params["type"] == "new")
                            {
                                titleLabel.Text = " - New Calls";
                                GridView1.Columns[4].Visible = false;

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsNewCalls";
                                CallDataSource.SelectCountMethod = "GetModelsNewCallsCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsNewCalls(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "nodate")
                            {
                                titleLabel.Text = " - No Date";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsNoDate";
                                CallDataSource.SelectCountMethod = "GetModelsNoDateCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsNoDate(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "incomplete")
                            {
                                titleLabel.Text = " - Visit Booked";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsIncomplete";
                                CallDataSource.SelectCountMethod = "GetModelsIncompleteCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsIncomplete(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "parts")
                            {
                                titleLabel.Text = " - Parts Required";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsRequiresOrder";
                                CallDataSource.SelectCountMethod = "GetModelsRequiresOrderCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsRequiresOrder(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "wip")
                            {
                                titleLabel.Text = " - Work in Progress";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsAllWIP";
                                CallDataSource.SelectCountMethod = "GetModelsAllWIPCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsAllWIP(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "RMAcollect")
                            {
                                titleLabel.Text = " - RMA collection";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsRMACollection";
                                CallDataSource.SelectCountMethod = "GetModelsRMACollectionCount";
                                // ---------------------------------------------

                                // Test Peter: ---------------------------------
                                // callsBLL.List = callsBLL.GetModelsAllClosed(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "S2CList")
                            {
                                titleLabel.Text = " - Swap to credit";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsS2C";
                                CallDataSource.SelectCountMethod = "GetModelsS2Ccount";
                                // ---------------------------------------------

                                // Test Peter: ---------------------------------
                                // callsBLL.List = callsBLL.GetModelsAllClosed(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "closed")
                            {
                                titleLabel.Text = " - Closed";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsAllClosed";
                                CallDataSource.SelectCountMethod = "GetModelsAllClosedCount";
                                // ---------------------------------------------

                                // Test Peter: ---------------------------------
                                // callsBLL.List = callsBLL.GetModelsAllClosed(session.Login.SaediId);
                            }
                            else if (session.Params["type"] == "search" && session.Params["status"] == "1")
                            {
                                titleLabel.Text = " - Search for New";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsBySearch";
                                CallDataSource.SelectCountMethod = "GetModelsBySearchCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsBySearch(session.Login.SaediId, session.Params["callId"], session.Params["postCode"], session.Params["surname"], session.Params["status"]);
                            }
                            else if (session.Params["type"] == "Reservationsearch")
                            {
                                // CallDataSource.SelectParameters.Add(new Parameter("ReservationId"));
                                CallDataSource.SelectMethod      = "GetModelsByReservationsearch";
                                CallDataSource.SelectCountMethod = "GetModelsByReservationsearchCount";
                            }
                            else if (session.Params["type"] == "search")
                            {
                                titleLabel.Text = " - Search Results";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsBySearch";
                                CallDataSource.SelectCountMethod = "GetModelsBySearchCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsBySearch(session.Login.SaediId, session.Params["callId"], session.Params["postCode"], session.Params["surname"], session.Params["status"]);
                            }
                            else
                            {
                                titleLabel.Text = "Service Calls";

                                // Test Peter: ---------------------------------
                                CallDataSource.SelectMethod      = "GetModelsAllWIP";
                                CallDataSource.SelectCountMethod = "GetModelsAllWIPCount";
                                // ---------------------------------------------

                                // callsBLL.List = callsBLL.GetModelsAllWIP(session.Login.SaediId);
                            }
                        }
                    }
                }
                catch (Exception ex)
                { ex.ToString(); }
            }
        }
Exemple #13
0
        protected void btnCreateConsignment_Click(object sender, EventArgs e)
        {
            int n;

            string[] v = new string[] { txtParcelWeight.Text, txtParcelWidth.Text, txtParcelLength.Text, txtParcelDepth.Text };

            if (v.Any(x => !int.TryParse(x, out n) || (int.TryParse(x, out n) && n < 1)))
            {
                UpdateVisibility(false, true, true, false);
            }
            else
            {
                try
                {
                    SiteSession                        session;
                    int                                shipmateConsignmentCreationId;
                    Shipmate                           shipmate;
                    RMARefBLL                          rmaRefBLL      = new RMARefBLL();
                    CourierRMABLL                      onlinemediaBLL = new CourierRMABLL();
                    CreateConsignmentRequest           createConsignmentRequest;
                    int                                serviceID;
                    string                             consignmentReference, serviceKey;
                    Mobile.Portal.BLL.Shipmate.Address collectionAddress, toAddress;
                    List <Parcel>                      parcels;

                    session              = SiteSessionFactory.LoadSession(this.Page);
                    shipmate             = new Shipmate(session.Login.CreatedBy);
                    serviceID            = int.Parse(txtServiceID.Text);
                    consignmentReference = txtConsignmentReference.Text;
                    serviceKey           = txtServiceKey.Text;

                    collectionAddress = new Mobile.Portal.BLL.Shipmate.Address(
                        txtCollectionFromName.Text,
                        txtCollectionFromLine1.Text,
                        txtCollectionFromLine2.Text,
                        txtCollectionFromLine3.Text,
                        txtCollectionFromCompanyName.Text,
                        txtCollectionFromTelephone.Text,
                        txtCollectionFromEmailAddress.Text,
                        txtCollectionFromCity.Text,
                        txtCollectionFromPostcode.Text,
                        txtCollectionFromCountry.Text);

                    toAddress = new Mobile.Portal.BLL.Shipmate.Address(
                        txtDeliveryToName.Text,
                        txtDeliveryToLine1.Text,
                        txtDeliveryToLine2.Text,
                        txtDeliveryToLine3.Text,
                        txtDeliveryToCompanyName.Text,
                        txtDeliveryToTelephone.Text,
                        txtDeliveryToEmailAddress.Text,
                        txtDeliveryToCity.Text,
                        txtDeliveryToPostcode.Text,
                        txtDeliveryToCountry.Text);

                    parcels = new List <Parcel>();
                    parcels.Add(new Parcel(txtParcelReference.Text, int.Parse(txtParcelWeight.Text), int.Parse(txtParcelWidth.Text), int.Parse(txtParcelLength.Text), int.Parse(txtParcelDepth.Text)));

                    createConsignmentRequest = new CreateConsignmentRequest(serviceID, consignmentReference, null, serviceKey, collectionAddress, toAddress, parcels);

                    string trackingReference = shipmate.CreateConsignment(SaediFromId.Value, createConsignmentRequest, out shipmateConsignmentCreationId);

                    object shipmateConsignmentDetails = shipmate.GetShipmateConsignmentDetails(trackingReference);
                    ShipmateConsignmentRequestRepsonseDetails shipmateConsignmentRequestRepsonseDetails = shipmate.GetShipmateConsignmentRequestRepsonseDetails(shipmateConsignmentDetails);

                    Mobile.Portal.BLL.Shipmate.Address collectionFromAddress = shipmate.GetCollectionFromAddress(shipmateConsignmentDetails);
                    Mobile.Portal.BLL.Shipmate.Address deliveryToAddress     = shipmate.GetDeliveryToAddress(shipmateConsignmentDetails);

                    rmaRefBLL.UpdateCollectionjob(txtConsignmentReference.Text, trackingReference, null, false, shipmateConsignmentCreationId);

                    int linkId = int.Parse(ClientRef.Value);

                    if (linkId != 0) //When linkId == 0 it is a PartStock and for those we don't need to call AddMediaMapping according to Paul/Vijay 19/06/2019
                    {
                        onlinemediaBLL.AddMediaMapping(OnlineBookingURL.Value, shipmateConsignmentRequestRepsonseDetails.MediaGUID, true, "pdf", "Courier Collection Label", linkId, (int)MediaTypeId.ServiceCall, (int)MediaContextId.General, SaediFromId.Value);
                    }

                    SetLblText(shipmateConsignmentRequestRepsonseDetails, collectionFromAddress, deliveryToAddress);
                    consignmentState.Value = "Create success";
                    UpdateVisibility(false, true, false, false);
                }
                catch (Exception ex)
                {
                    spanError.InnerText = string.Format("An error occurred: {0}", ex.Message);
                    UpdateVisibility(false, false, false, true);
                }
            }
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            string title = Request.QueryString["Title"];

            if (title != null)
            {
                lblTitle.Text = title;
            }

            if (title == null) //Configuration (the default)
            {
                UpdateVisibility(true, false, false, false);
                divModalHeader.Visible = false;
                divModalBody.Visible   = false;
                configState.Value      = "ConfigSearch";
            }
            else if (title == "Book Courier Collection")
            {
                string saediFromId = Request.QueryString["SaediFromId"];
                string rmaId       = Request.QueryString["RmaId"];
                string clientRef   = Request.QueryString["ClientRef"];
                string onlineBookingURL;

                SiteSession session  = SiteSessionFactory.LoadSession(this.Page);
                Shipmate    shipmate = new Shipmate(session.Login.CreatedBy);

                CreateConsignmentRequest createConsignmentRequest = shipmate.GetCreateConsignmentRequest(saediFromId, rmaId, clientRef, out onlineBookingURL);

                txtParcelWeight.Text               = "3000";
                txtParcelWidth.Text                = "20";
                txtParcelLength.Text               = "10";
                txtParcelDepth.Text                = "15";
                txtConsignmentReference.Text       = createConsignmentRequest.consignment_reference;
                txtParcelReference.Text            = createConsignmentRequest.consignment_reference + "-1";
                txtServiceID.Text                  = createConsignmentRequest.ServiceID.ToString();
                txtServiceKey.Text                 = createConsignmentRequest.service_key;
                txtCollectionFromName.Text         = createConsignmentRequest.collection_address.name;
                txtCollectionFromLine1.Text        = createConsignmentRequest.collection_address.line_1;
                txtCollectionFromLine2.Text        = createConsignmentRequest.collection_address.line_2;
                txtCollectionFromLine3.Text        = createConsignmentRequest.collection_address.line_3;
                txtCollectionFromCompanyName.Text  = createConsignmentRequest.collection_address.company_name;
                txtCollectionFromTelephone.Text    = createConsignmentRequest.collection_address.telephone;
                txtCollectionFromEmailAddress.Text = createConsignmentRequest.collection_address.email_address;
                txtCollectionFromCity.Text         = createConsignmentRequest.collection_address.city;
                txtCollectionFromPostcode.Text     = createConsignmentRequest.collection_address.postcode;
                txtCollectionFromCountry.Text      = createConsignmentRequest.collection_address.country;
                txtDeliveryToName.Text             = createConsignmentRequest.to_address.name;
                txtDeliveryToLine1.Text            = createConsignmentRequest.to_address.line_1;
                txtDeliveryToLine2.Text            = createConsignmentRequest.to_address.line_2;
                txtDeliveryToLine3.Text            = createConsignmentRequest.to_address.line_3;
                txtDeliveryToCompanyName.Text      = createConsignmentRequest.to_address.company_name;
                txtDeliveryToTelephone.Text        = createConsignmentRequest.to_address.telephone;
                txtDeliveryToEmailAddress.Text     = createConsignmentRequest.to_address.email_address;
                txtDeliveryToCity.Text             = createConsignmentRequest.to_address.city;
                txtDeliveryToPostcode.Text         = createConsignmentRequest.to_address.postcode;
                txtDeliveryToCountry.Text          = createConsignmentRequest.to_address.country;
                consignmentState.Value             = "Create";
                SaediFromId.Value                  = saediFromId; //Hidden field
                ClientRef.Value        = clientRef;               //Hidden field
                OnlineBookingURL.Value = onlineBookingURL;        //Hidden field

                UpdateVisibility(false, true, false, false);
            }
            else if (title == "Consignment details")
            {
                try
                {
                    lblTitle.Text = title;
                    SiteSession session                    = SiteSessionFactory.LoadSession(this.Page);
                    Shipmate    shipmate                   = new Shipmate(session.Login.CreatedBy);
                    string      trackingReference          = Request.QueryString["TrackingReference"];
                    object      shipmateConsignmentDetails = shipmate.GetShipmateConsignmentDetails(trackingReference);
                    ShipmateConsignmentRequestRepsonseDetails shipmateConsignmentRequestRepsonseDetails = shipmate.GetShipmateConsignmentRequestRepsonseDetails(shipmateConsignmentDetails);
                    Mobile.Portal.BLL.Shipmate.Address        collectionFromAddress = shipmate.GetCollectionFromAddress(shipmateConsignmentDetails);
                    Mobile.Portal.BLL.Shipmate.Address        deliveryToAddress     = shipmate.GetDeliveryToAddress(shipmateConsignmentDetails);
                    SetLblText(shipmateConsignmentRequestRepsonseDetails, collectionFromAddress, deliveryToAddress);
                    consignmentState.Value = "Show details";
                    UpdateVisibility(false, true, false, false);
                }
                catch (Exception ex)
                {
                    spanError.InnerText = string.Format("An error occurred: {0}", ex.Message);
                    UpdateVisibility(false, false, false, true);
                }
            }
            else
            {
                spanError.InnerText = "Incorrect Title in the query string!";
                UpdateVisibility(false, false, false, true);
            }
        }