示例#1
0
        public JsonResult GetProductQaData(int orderID, string orderName, string prodName, int ordLine)
        {
            OrderItems oi = new OrderItems();
            PageObject po = new PageObject();
            Sample     s  = new Sample();

            po.User        = Session["USER_LOGIN"] as AppUser;
            s.UserLanguage = oi.UserLanguage = po.User.Language;

            if (string.IsNullOrEmpty(orderName) || (orderName.Equals("undefined")))
            {
                Order o = new Order();
                o.UserLanguage = po.User.Language;
                po.objOrder    = o.GetOrderDetails(orderID);
                if (null != po.objOrder)
                {
                    orderName = po.objOrder.ORDNAME;

                    // Get order line text
                    //if ((null != po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM.Length > 0))
                    //{
                    //    po.objItemText = new OrdersItemText();
                    //    foreach (OrdersItemText item in po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM)
                    //    {
                    //        po.objItemText.TEXT += item.TEXT.Replace(" ", " ").Replace("Pdir", "P dir");
                    //    }
                    //}
                }
            }
            else
            {
                po.objOrder = oi.GetProductDetailse(po.User.Supplier_ID, orderName, prodName);
            }
            if (null == po.objOrder)
            {
                return(Json(po));
            }

            // Get order line text
            if ((null != po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM.Length > 0))
            {
                po.objItemText = new OrdersItemText();
                foreach (OrdersItemText item in po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM)
                {
                    po.objItemText.TEXT += item.TEXT.Replace(" ", " ").Replace("Pdir", "P dir");
                }
            }

            po.objProduct      = po.objOrder.PORDERITEMS_SUBFORM[0];
            po.lstSampleObject = s.GetOrderSamples(orderName, po.User.Supplier_ID, prodName);

            // Get Attachments
            if ((null == po.objOrder.EXTFILES_SUBFORM) || (po.objOrder.EXTFILES_SUBFORM.Count /*Length*/ == 0))
            {
                GetProductAttachments(orderID, prodName, ref po);
            }
            else
            {
                po.lstAttachments = new List <Attachments>();
                po.lstAttachments.AddRange(po.objOrder.EXTFILES_SUBFORM);
                foreach (Attachments item in po.lstAttachments)
                {
                    string[] arr = item.EXTFILENAME.Split('\\'); //item.EXTFILENAME.Split(' / ');
                    if (string.IsNullOrEmpty(arr[arr.Length - 1]))
                    {
                        item.FILE_NAME = arr[0];
                        item.FOLDER    = arr[1];
                    }
                    else
                    {
                        item.FILE_NAME = arr[arr.Length - 1];
                        item.FOLDER    = arr[arr.Length - 2];
                    }
                }
            }

            return(Json(po));
        }
示例#2
0
        private PageObject GetOrder(int orderID, string orderNumber)
        {
            Order      o  = new Order();
            Product    p  = new Product();
            PageObject po = new PageObject();
            OrderType  oi = null;

            po.objSample           = new Sample();
            po.lstOrderAttachments = new List <OrderAttachment>();
            po.User        = Session["USER_LOGIN"] as AppUser;
            o.UserLanguage = po.User.Language;
            po.objOrder    = o.GetOrderDetails(orderID);
            if (null != po.objOrder)
            {
                po.lstOrderAttachments = o.GetOrderAttachments(po.objOrder.ORDNAME);
                if (null != po.lstOrderAttachments && po.lstOrderAttachments.Count > 0)
                {
                    if (null != po.lstOrderAttachments[0].EXTFILES_SUBFORM && po.lstOrderAttachments[0].EXTFILES_SUBFORM.Count > 0)
                    {
                        foreach (Attachments item in po.lstOrderAttachments[0].EXTFILES_SUBFORM)
                        {
                            string[] arr = item.EXTFILENAME.Split('\\');
                            if (string.IsNullOrEmpty(arr[arr.Length - 1]))
                            {
                                item.FILE_NAME = arr[0];
                                item.FOLDER    = arr[1];
                            }
                            else
                            {
                                if (arr.Length == 3)
                                {
                                    item.FILE_NAME = arr[arr.Length - 1];
                                    item.FOLDER    = arr[arr.Length - 2];
                                }
                                if (arr.Length == 4)
                                {
                                    item.FILE_NAME = arr[arr.Length - 1];
                                    item.FOLDER    = arr[arr.Length - 3] + @"\" + arr[arr.Length - 2];
                                }
                            }
                        }
                    }
                }
                if ((null != po.objOrder.PORDERSTEXT_SUBFORM) /* && (po.objOrder.PORDERSTEXT_SUBFORM.Count/*Length > 0)*/)
                {
                    //foreach (PORDERSTEXT item in po.objOrder.PORDERSTEXT_SUBFORM)
                    //{
                    po.objOrderText += po.objOrder.PORDERSTEXT_SUBFORM.TEXT.Replace("Pdir", "P dir").Replace("dir", " dir");
                    //po.objOrderText += item.TEXT.Replace(" ", "&nbsp;").Replace("Pdir", "P dir").Replace("dir", " dir");
                    //}
                }
                if (null != po.objOrder.PORDERITEMS_SUBFORM)
                {
                    po.lstItemsObject = new List <OrderItems>();
                    po.lstItemsObject.AddRange(po.objOrder.PORDERITEMS_SUBFORM);
                    foreach (OrderItems item in po.lstItemsObject)
                    {
                        item.ORD     = po.objOrder.ORD;
                        item.ORDNAME = po.objOrder.ORDNAME;
                    }
                }

                if (!string.IsNullOrEmpty(po.objOrder.TYPECODE))
                {
                    oi = new OrderType();
                    if (po.User.Language.Equals("English"))
                    {
                        po.htmlText = oi.GetOrderTypeText_EN(po.objOrder.TYPECODE);
                    }
                    else
                    {
                        po.htmlText = oi.GetOrderTypeText(po.objOrder.TYPECODE);
                    }
                }
            }
            return(po);
        }
示例#3
0
        private object getPostProductTestData(int orderID, string prodName, int ordLine)
        {
            Sample      s  = new Sample();
            Order       o  = new Order();
            Product     p  = new Product();
            PageObject  po = new PageObject();
            DelayReason d  = new DelayReason();

            po.lstAttachments      = new List <Attachments>();
            po.lstOrderAttachments = new List <OrderAttachment>();
            po.User                = Session["USER_LOGIN"] as AppUser;
            o.UserLanguage         = po.User.Language;
            d.UserLanguage         = po.User.Language;
            s.UserLanguage         = po.User.Language;
            po.objOrder            = o.GetOrderProductDetails(orderID, prodName);
            po.lstDelayReason      = d.GetDelayReasons();
            po.lstOrderAttachments = o.GetOrderAttachments(po.objOrder.ORDNAME);
            if (null != po.lstOrderAttachments && po.lstOrderAttachments.Count > 0)
            {
                if (null != po.lstOrderAttachments[0].EXTFILES_SUBFORM && po.lstOrderAttachments[0].EXTFILES_SUBFORM.Count > 0)
                {
                    foreach (Attachments item in po.lstOrderAttachments[0].EXTFILES_SUBFORM)
                    {
                        string[] arr = item.EXTFILENAME.Split('\\'); //item.EXTFILENAME.Split(' / ');
                        if (string.IsNullOrEmpty(arr[arr.Length - 1]))
                        {
                            item.FILE_NAME = arr[0];
                            item.FOLDER    = arr[1];
                        }
                        else
                        {
                            if (arr.Length == 3)
                            {
                                item.FILE_NAME = arr[arr.Length - 1];
                                item.FOLDER    = arr[arr.Length - 2];
                            }
                            if (arr.Length == 4)
                            {
                                item.FILE_NAME = arr[arr.Length - 1];
                                item.FOLDER    = arr[arr.Length - 3] + @"\" + arr[arr.Length - 2];
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(po.objOrder.TYPECODE))
            {
                OrderType oi = new OrderType();
                if (po.User.Language.Equals("English"))
                {
                    po.htmlText = oi.GetOrderTypeText_EN(po.objOrder.TYPECODE);
                }
                else
                {
                    po.htmlText = oi.GetOrderTypeText(po.objOrder.TYPECODE);
                }
            }

            if ((null != po.objOrder.PORDERITEMS_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM.Count /*Length*/ > 0))
            {
                po.objProduct         = po.objOrder.PORDERITEMS_SUBFORM[0];
                po.objProduct.ORD     = po.objOrder.ORD;
                po.objProduct.ORDNAME = po.objOrder.ORDNAME;
                // Get order line text
                if ((null != po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM.Length > 0))
                {
                    po.objItemText = new OrdersItemText();
                    foreach (OrdersItemText item in po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM)
                    {
                        po.objItemText.TEXT += item.TEXT.Replace(" ", "&nbsp;").Replace("Pdir", "P dir");
                    }
                }

                if (null != po.objProduct)
                {
                    GetProductObjAndSamples(po.objOrder.OrderID, po.objOrder.OrderNumber, po.objProduct.PARTNAME, ordLine, ref po);
                }

                // Get Sampels
                if ((null != po.objSample) && (null != po.objSample.MED_TRANSSAMPLEQA_SUBFORM) && (po.objSample.MED_TRANSSAMPLEQA_SUBFORM.Count > 0))
                {
                    foreach (Sample_QA item in po.objSample.MED_TRANSSAMPLEQA_SUBFORM)
                    {
                        item.DOCNO    = po.objSample.DOCNO;
                        item.SUPNAME  = po.objSample.SUPNAME;
                        item.PARTNAME = po.objSample.PARTNAME;
                    }
                }
            }
            // Get Attachments
            if ((null == po.objOrder.EXTFILES_SUBFORM) || (po.objOrder.EXTFILES_SUBFORM.Count /*.Length*/ == 0))
            {
                GetProductAttachments(orderID, prodName, ref po);
            }
            else
            {
                po.lstAttachments = new List <Attachments>();
                po.lstAttachments.AddRange(po.objOrder.EXTFILES_SUBFORM);
                foreach (Attachments item in po.lstAttachments)
                {
                    string[] arr = item.EXTFILENAME.Split('\\'); //item.EXTFILENAME.Split(' / ');
                    if (string.IsNullOrEmpty(arr[arr.Length - 1]))
                    {
                        item.FILE_NAME = arr[0];
                        item.FOLDER    = arr[1];
                    }
                    else
                    {
                        item.FILE_NAME = arr[arr.Length - 1];
                        item.FOLDER    = arr[arr.Length - 2];
                    }
                }
            }
            return(po);
        }
示例#4
0
        private void GetProductObjAndSamples(int orderID, string orderName, string prodName, int ordLine, ref PageObject po)
        {
            Sample s = new Sample();
            Order  o = new Order();

            if (null != po.objOrder)
            {
                try
                {
                    if ((null != po.objOrder.PORDERITEMS_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM.Count /*Length*/ > 0))
                    {
                        po.objProduct         = po.objOrder.PORDERITEMS_SUBFORM[0];
                        po.objProduct.ORD     = po.objOrder.ORD;
                        po.objProduct.ORDNAME = po.objOrder.ORDNAME;
                        po.objSample          = s.GetProductSamples(po.User.Supplier_ID, po.objOrder.ORDNAME, po.objProduct.PARTNAME, ordLine);

                        if ((null != po.objSample) && (!string.IsNullOrEmpty(po.objSample.DOCNO)))
                        {
                            //po.objSample.pageCURDATE = po.objSample.CURDATE.ToShortDateString();
                            foreach (Sample_QA item in po.objSample.MED_TRANSSAMPLEQA_SUBFORM)
                            {
                                item.DOCNO    = po.objSample.DOCNO;
                                item.SUPNAME  = po.objSample.SUPNAME;
                                item.PARTNAME = po.objSample.PARTNAME;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    AppLogger.log.Info("GetProductObjAndSamples ==> exeption = ", ex);
                }
            }
        }
示例#5
0
        public JsonResult GetSalesorderDetail(int orderID, string prodName, int ordLine)
        {
            if (Session["USER_LOGIN"] == null)
            {
                return(Json(RedirectToAction("Login", "Account")));
            }
            PageObject po = new PageObject();

            po.User = Session["USER_LOGIN"] as AppUser;
            Sample s = new Sample();
            Order  o = new Order();
            //Product p = new Product();
            DelayReason d = new DelayReason();

            po.lstAttachments      = new List <Attachments>();
            po.lstOrderAttachments = new List <OrderAttachment>();
            o.UserLanguage         = po.User.Language;
            d.UserLanguage         = po.User.Language;
            s.UserLanguage         = po.User.Language;
            string tmpProdName = prodName;

            prodName = prodName.Replace("#", "");

            po.objOrder = o.GetOrderProductDetailsByLine(orderID, prodName, ordLine);
            if (null == po.objOrder || null == po.objOrder.PORDERITEMS_SUBFORM || po.objOrder.PORDERITEMS_SUBFORM.Count /*Length*/ == 0)
            {
                po.ErrorDescription = "Bed request ==> PART NAME was not found => PARTNAME = " + tmpProdName;
                return(Json(po));
            }
            po.lstDelayReason      = d.GetDelayReasons();
            po.lstOrderAttachments = o.GetOrderAttachments(po.objOrder.ORDNAME);

            if (null != po.lstOrderAttachments && po.lstOrderAttachments.Count > 0)
            {
                if (null != po.lstOrderAttachments[0].EXTFILES_SUBFORM && po.lstOrderAttachments[0].EXTFILES_SUBFORM.Count > 0)
                {
                    foreach (Attachments item in po.lstOrderAttachments[0].EXTFILES_SUBFORM)
                    {
                        string[] arr = item.EXTFILENAME.Split('\\'); //item.EXTFILENAME.Split(' / ');
                        if (string.IsNullOrEmpty(arr[arr.Length - 1]))
                        {
                            item.FILE_NAME = arr[0];
                            item.FOLDER    = arr[1];
                        }
                        else
                        {
                            if (arr.Length == 3)
                            {
                                item.FILE_NAME = arr[arr.Length - 1];
                                item.FOLDER    = arr[arr.Length - 2];
                            }
                            if (arr.Length == 4)
                            {
                                item.FILE_NAME = arr[arr.Length - 1];
                                item.FOLDER    = arr[arr.Length - 3] + @"\" + arr[arr.Length - 2];
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(po.objOrder.TYPECODE))
            {
                OrderType oi = new OrderType();
                if (po.User.Language.Equals("English"))
                {
                    po.htmlText = oi.GetOrderTypeText_EN(po.objOrder.TYPECODE);
                }
                else
                {
                    po.htmlText = oi.GetOrderTypeText(po.objOrder.TYPECODE);
                }
            }

            if ((null != po.objOrder.PORDERSTEXT_SUBFORM) /* && (po.objOrder.PORDERSTEXT_SUBFORM.Count/*Length > 0)*/)
            {
                //foreach (PORDERSTEXT item in po.objOrder.PORDERSTEXT_SUBFORM)
                //{
                po.objOrderText += po.objOrder.PORDERSTEXT_SUBFORM.TEXT.Replace("Pdir", "P dir").Replace("dir", " dir");
                //po.objOrderText += item.TEXT.Replace(" ", "&nbsp;").Replace("Pdir", "P dir").Replace("dir", " dir");
                //}
            }

            if ((null != po.objOrder.PORDERITEMS_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM.Count /*Length*/ > 0))
            {
                po.objProduct                 = po.objOrder.PORDERITEMS_SUBFORM[0];
                po.objProduct.ORD             = po.objOrder.ORD;
                po.objProduct.ORDNAME         = po.objOrder.ORDNAME;
                po.objProduct.SHR_SUP_REMARKS = po.objProduct.GerSupplierRemarks(po.objOrder.ORDNAME, po.objProduct.KLINE);
                // Get order line text
                if ((null != po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM) && (po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM.Length > 0))
                {
                    po.objItemText = new OrdersItemText();
                    foreach (OrdersItemText item in po.objOrder.PORDERITEMS_SUBFORM[0].PORDERITEMSTEXT_SUBFORM)
                    {
                        po.objItemText.TEXT += item.TEXT.Replace(" ", "&nbsp;").Replace("Pdir", "P dir");
                    }
                }
            }
            return(Json(po));
        }