Beispiel #1
0
        public ActionResult _DetailODSCP(int OrderID)
        {
            var dataODS    = FacadeOrder.Get(OrderID);
            var dataClient = FacadeClient.GetByID(dataODS.FK_ClientID);
            var dataBI     = FacadeInstalledBase.GetByID(dataODS.FK_InstalledBaseID);

            ViewBag.dataODS    = dataODS;
            ViewBag.dataClient = dataClient;
            return(PartialView());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var arrODS = FacadeOrder.GetAll().Where(p => p.OrderExecuteDate.Equals(new DateTime(2017, 11, 8)));
            int j      = 1;

            Console.WriteLine("Total: " + arrODS.Count().ToString());

            foreach (var i in arrODS)
            {
                try
                {
                    Console.WriteLine(j.ToString() + " de " + arrODS.Count().ToString());

                    var dataODS           = FacadeOrder.Get(i.PK_OrderID);
                    var dataClient        = FacadeClient.GetByID(i.FK_ClientID);
                    var dataBaseInstalled = FacadeInstalledBase.GetByID(dataODS.FK_InstalledBaseID);
                    var dataProduct       = FacadeProduct.GetByID(dataBaseInstalled.FK_ProductID.Value);
                    var dataHistory       = FacadeMabe.HistoryODSByClient(dataClient.ClientID, dataBaseInstalled.InstalledBaseID);

                    // insertar datos order history
                    foreach (var item in dataHistory)
                    {
                        var dataDBHistory = FacadeHistory.GetByOrderID(dataODS.PK_OrderID);

                        if (dataDBHistory.Where(p => p.OrderID == item.ID_Oper).Count() > 0)
                        {
                            // update
                            var entity = dataDBHistory.Where(p => p.OrderID == item.ID_Oper).FirstOrDefault();
                            entity.CloseDate          = ParseDate(item.Fecha_Cierre_Orden);
                            entity.Failure1           = string.IsNullOrEmpty(item.Desc_ID_Falla1) ? "" : item.Desc_ID_Falla1;
                            entity.Failure2           = string.IsNullOrEmpty(item.Desc_ID_Falla2) ? "" : item.Desc_ID_Falla2;
                            entity.Failure3           = string.IsNullOrEmpty(item.Desc_ID_Falla3) ? "" : item.Desc_ID_Falla3;
                            entity.FailureID1         = string.IsNullOrEmpty(item.ID_Falla1) ? "" : item.ID_Falla1;
                            entity.FailureID2         = string.IsNullOrEmpty(item.ID_Falla2) ? "" : item.ID_Falla2;
                            entity.FailureID3         = string.IsNullOrEmpty(item.ID_Falla3) ? "" : item.ID_Falla3;
                            entity.FK_ClientID        = dataODS.FK_ClientID;
                            entity.FK_InstalledBaseID = dataODS.FK_InstalledBaseID;
                            entity.FK_OrderID         = dataODS.PK_OrderID;
                            entity.Guaranty           = string.IsNullOrEmpty(item.Tipo_Serv) ? "" : item.Tipo_Serv;
                            entity.ItemStatus         = string.IsNullOrEmpty(item.Estatus_Visita) ? "" : item.Estatus_Visita;
                            entity.ModifyDate         = DateTime.UtcNow;
                            entity.OrderID            = string.IsNullOrEmpty(item.ID_Oper) ? "" : item.ID_Oper;
                            entity.OrderStatus        = string.IsNullOrEmpty(item.Estatus_Oper) ? "" : item.Estatus_Oper;
                            entity.ShopDate           = new DateTime(1980, 1, 1);
                            entity.Status             = true;
                            FacadeHistory.Update(entity);
                        }
                        else
                        {
                            // insert
                            var entity = new EntityHistory();
                            entity.CloseDate          = ParseDate(item.Fecha_Cierre_Orden);
                            entity.CreateDate         = DateTime.UtcNow;
                            entity.Failure1           = string.IsNullOrEmpty(item.Desc_ID_Falla1) ? "" : item.Desc_ID_Falla1;
                            entity.Failure2           = string.IsNullOrEmpty(item.Desc_ID_Falla2) ? "" : item.Desc_ID_Falla2;
                            entity.Failure3           = string.IsNullOrEmpty(item.Desc_ID_Falla3) ? "" : item.Desc_ID_Falla3;
                            entity.FailureID1         = string.IsNullOrEmpty(item.ID_Falla1) ? "" : item.ID_Falla1;
                            entity.FailureID2         = string.IsNullOrEmpty(item.ID_Falla2) ? "" : item.ID_Falla2;
                            entity.FailureID3         = string.IsNullOrEmpty(item.ID_Falla3) ? "" : item.ID_Falla3;
                            entity.FK_ClientID        = dataODS.FK_ClientID;
                            entity.FK_InstalledBaseID = dataODS.FK_InstalledBaseID;
                            entity.FK_OrderID         = dataODS.PK_OrderID;
                            entity.Guaranty           = string.IsNullOrEmpty(item.Tipo_Serv) ? "" : item.Tipo_Serv;
                            entity.ItemStatus         = string.IsNullOrEmpty(item.Estatus_Visita) ? "" : item.Estatus_Visita;
                            entity.ModifyDate         = DateTime.UtcNow;
                            entity.OrderID            = string.IsNullOrEmpty(item.ID_Oper) ? "" : item.ID_Oper;
                            entity.OrderStatus        = string.IsNullOrEmpty(item.Estatus_Oper) ? "" : item.Estatus_Oper;
                            entity.PK_HistoryID       = 0;
                            entity.ShopDate           = new DateTime(1980, 1, 1);
                            entity.Status             = true;
                            FacadeHistory.Insert(entity);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                }

                j++;
            }

            //Inventory();
            //RestImage();

            //SendEmial();

            //foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
            //    Console.WriteLine(z.Id);

            //Console.WriteLine(FacadeGoogle.GetLocalDateTime(19.3850, -99.1650, DateTime.UtcNow));

            //string CLIENT_ID = "6538892993478012";
            //string CLIENT_SECRET = "GGGzSZuzfdBDpua7g7wyZo9qiTrnTvcS";
            //MP mp = new MP(CLIENT_ID, CLIENT_SECRET);

            //Hashtable data = mp.getPaymentInfo("9406314591T0170101000525SFODS");

            // Sets the filters you want
            //Dictionary<String, String> filters = new Dictionary<String, String>();
            //filters.Add("site_id", "MLM"); // Argentina: MLA; Brasil: MLB

            // Search payment data according to filters
            //Hashtable searchResult = mp.searchPayment(filters);

            // Show payment information
            //foreach (Hashtable payment in searchResult.SelectToken("response.results"))
            //{
            //    Console.WriteLine(String.Format("{0}", payment["collection"]["id"]));
            //}
            Console.WriteLine("Finish");
            Console.ReadKey();
        }