예제 #1
0
        public CreatedExchangeHeader CreateExchangeOrder(string rmaNo, string externalDocumentNo, string lineValues, int zendeskTicketNo)
        {
            CreatedExchangeOrder  ceo = new CreatedExchangeOrder();
            CreatedExchangeHeader ceh = new CreatedExchangeHeader();

            ceo = webService.CreateExchange(rmaNo, externalDocumentNo, lineValues, zendeskTicketNo);

            ceh = CreateExchange(ceo);
            return(ceh);
        }
예제 #2
0
        protected CreatedExchangeHeader CreateExchange(CreatedExchangeOrder eo)
        {
            CreatedExchangeHeader ceh = new CreatedExchangeHeader();
            string orderNo            = string.Empty;
            string externalDocumentNo = string.Empty;
            string orderDate          = string.Empty;
            string channelName        = string.Empty;
            string shipMethod         = string.Empty;
            string rmaNo                      = string.Empty;
            string shipToName                 = string.Empty;
            string shipToAddress1             = string.Empty;
            string shipToAddress2             = string.Empty;
            string shipToContact              = string.Empty;
            string shipToCity                 = string.Empty;
            string shipToZip                  = string.Empty;
            string shipToState                = string.Empty;
            string shipToCountry              = string.Empty;
            List <CreatedExchangeLines> lines = new List <CreatedExchangeLines>();

            if (eo.SalesHeader != null)
            {
                orderNo            = eo.SalesHeader[0].No;
                externalDocumentNo = eo.SalesHeader[0].ExtDocNo;
                orderDate          = eo.SalesHeader[0].DocDate;
                channelName        = eo.SalesHeader[0].SellToCustomerName;
                shipMethod         = eo.SalesHeader[0].ShippingAgent;
                shipMethod        += " " + eo.SalesHeader[0].ShippingService;
                rmaNo          = eo.SalesHeader[0].RMANo1;
                lines          = CreateExchangeOrderLines(eo);
                shipToName     = eo.SalesHeader[0].ShipToName;
                shipToAddress1 = eo.SalesHeader[0].ShipToAddress;
                shipToAddress2 = eo.SalesHeader[0].ShipToAddress2;
                shipToContact  = eo.SalesHeader[0].ShipToContact;
                shipToCity     = eo.SalesHeader[0].ShipToCity;
                shipToZip      = eo.SalesHeader[0].ShipToZip;
                shipToState    = eo.SalesHeader[0].ShipToState;
                shipToCountry  = eo.SalesHeader[0].ShipToCountry;

                ceh.OrderNo            = orderNo;
                ceh.ExternalDocumentNo = externalDocumentNo;
                ceh.OrderDate          = orderDate;
                ceh.ChannelName        = channelName;
                ceh.ShipMethod         = shipMethod;
                ceh.RMANo          = rmaNo;
                ceh.ExchangeLines  = lines;
                ceh.ShipToName     = shipToName;
                ceh.ShipToAddress1 = shipToAddress1;
                ceh.ShipToAddress2 = shipToAddress2;
                ceh.ShipToContact  = shipToContact;
                ceh.ShipToCity     = shipToCity;
                ceh.ShipToZip      = shipToZip;
                ceh.ShipToState    = shipToState;
                ceh.ShipToCountry  = shipToCountry;

                orderNo            = string.Empty;
                externalDocumentNo = string.Empty;
                orderDate          = string.Empty;
                channelName        = string.Empty;
                shipMethod         = string.Empty;
                rmaNo          = string.Empty;
                shipToAddress1 = string.Empty;
                shipToAddress2 = string.Empty;
                shipToContact  = string.Empty;
                shipToCity     = string.Empty;
                shipToZip      = string.Empty;
                shipToState    = string.Empty;
                shipToCountry  = string.Empty;
                lines          = new List <CreatedExchangeLines>();
            }

            return(ceh);
        }
예제 #3
0
        protected void BtnCreateExchange_Click(object sender, EventArgs e)
        {
            StringBuilder lineBuild = new StringBuilder();
            string        lineError = "";

            try
            {
                rmaNo = tcRMANo.Text;
                docNo = tcDocNo.Text;

                string validateMsg   = string.Empty;
                bool   allValidLines = true;
                int    rowCount      = 0;
                int    controlCount  = 0;

                if (!String.IsNullOrWhiteSpace(txtZendeskTicketNo.Text) || !String.IsNullOrEmpty(txtZendeskTicketNo.Text))
                {
                    if (txtZendeskTicketNo.Text.Length == 7)
                    {
                        int.TryParse(txtZendeskTicketNo.Text, out zendeskTicketNo);
                    }
                    else
                    {
                        validateMsg = "Zendesk Ticket # should be 7 numeric characters.";
                    }
                }

                if (validateMsg == string.Empty)
                {
                    foreach (TableRow row in tblCreateReturnOrderTableDetails.Rows)
                    {
                        rowCount++;
                        string itemNo          = string.Empty;
                        int    qtyReceivedLine = 0;
                        int    actionQty       = 0;

                        controlCount = 0;

                        foreach (TableCell cell in row.Cells)
                        {
                            if (cell.ID.Contains("itemNo"))
                            {
                                itemNo = cell.Text.ToString();
                            }

                            if (cell.ID.Contains("qtyReceived_"))
                            {
                                int.TryParse(cell.Text.ToString(), out qtyReceivedLine);
                            }

                            foreach (Control c in cell.Controls)
                            {
                                controlCount++;

                                if (c.GetType() == typeof(TextBox))
                                {
                                    string value = ((TextBox)c).Text;
                                    int.TryParse(value, out actionQty);
                                }
                            }

                            string lineValidMessage = string.Empty;

                            if ((rowCount > 1 && controlCount == 1))
                            {
                                lineValidMessage = ValidateLine(itemNo, qtyReceivedLine, actionQty);

                                if (lineValidMessage == "Valid Line Input")
                                {
                                    lineBuild.Append(itemNo).Append(":");
                                    lineBuild.Append(actionQty).Append(",");
                                }
                                else
                                {
                                    allValidLines = false;

                                    if (lineError == "")
                                    {
                                        lineError = lineValidMessage;
                                    }
                                }
                            }
                        }
                    }

                    if (allValidLines)
                    {
                        string lineValues = lineBuild.ToString();

                        CreatedExchangeHeader ceh = new CreatedExchangeHeader();

                        SendService ss = new SendService();

                        ceh = ss.CreateExchangeOrder(rmaNo, docNo, lineValues, zendeskTicketNo);
                        Session["CreatedExchange"]   = ceh;
                        Session["NoUserInteraction"] = true;
                        ClientScript.RegisterStartupScript(this.GetType(), "returnOrderNo", "alert('" + ceh.OrderNo + "');", true);
                        ClientScript.RegisterStartupScript(this.GetType(), "openCreatedExchange", "OpenCreateExchange();", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "lineError", "alert('" + lineError + "');", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "validateMsg", "alert('" + validateMsg + "');", true);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                ClientScript.RegisterStartupScript(this.GetType(), "errorAlert", "alert('" + ex.Message.Replace("'", "\"") + "');", true);

                if (ex.Message.ToLower().Contains("session"))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "closeErrorAlert", "parent.window.close();", true);
                }
            }
        }