Ejemplo n.º 1
0
        /// <summary>
        /// Factory que retorna la conexion al ERP Especifico
        /// </summary>
        /// <param name="whichFactory"></param>
        /// <returns></returns>
        public static ConnectFactory getConnectFactory(Company company)
        {
            FactoryCompany = company;

            switch (FactoryCompany.ErpConnection.ConnectionType.RowID)
            {
                    
                case CnnType.GPeConnect :
                    return new DynamicsGP.DynamicsGP_ec();

                case CnnType.Everest:
                    return new Everest.Everest();

                case CnnType.UnoEE :
                    return new UNOEE.Unoee();

                //case CnnType.GPWebServices:
                //    return new ConnectUnoEE();
                //case 3:
                //    return new ConnectDynamicsGP_ws();

                default:
                    return null;
            }
        }
Ejemplo n.º 2
0
        public DocumentTypeSequence GetNextDocSequence(Company company, DocumentType docType)
        {

            //crea el objeto de DocumentTypeSequence
            DocumentTypeSequence docSeq = new DocumentTypeSequence();
            docSeq.Company = company;
            docSeq.DocType = docType;

            //Solicita el Consecutivo para el documento
            docSeq = Factory.DaoDocumentTypeSequence().Select(docSeq).First();


            //Check Label Sequence 
            if (docType.DocTypeID == LabelType.ProductLabel)
            {
                long labelSeq = Factory.DaoLabel().SelectSequence();
                if (labelSeq > docSeq.NumSequence)
                    docSeq.NumSequence = labelSeq;
            }




            //Aumenta el consecutivo en Uno y lo guarda
            docSeq.NumSequence++;
            Factory.DaoDocumentTypeSequence().Update(docSeq);

            return docSeq;

        }
Ejemplo n.º 3
0
		public IEnumerable<Task> Can_get_total_count()
		{
			var dbname = GenerateNewDatabaseName();
			var documentStore = new DocumentStore { Url = Url + Port };
			documentStore.Initialize();
			yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);

			var entity = new Company { Name = "Async Company #1", Id = "companies/1" };
			using (var session = documentStore.OpenAsyncSession(dbname))
			{
				session.Store(entity);
				yield return session.SaveChangesAsync();
			}

			using (var session = documentStore.OpenAsyncSession(dbname))
			{
				RavenQueryStatistics stats;
				var query = session.Query<Company>()
					.Customize(x=>x.WaitForNonStaleResults())
					.Statistics(out stats)
					.Where(x => x.Name == "Async Company #1")
					.CountAsync();
				yield return query;

				Assert.AreEqual(1, query.Result);
			}
		}
Ejemplo n.º 4
0
        private void btnSelecCom_Click(object sender, EventArgs e)
        {
            if (selectedCom == null)
            {
                if (cboxCompanies.SelectedValue != null)
                {
                    selectedCom = (Entities.Company)cboxCompanies.SelectedValue;

                    companies.Remove(selectedCom);

                    WireUp();
                }
            }
            else
            {
                companies.Add(selectedCom);

                selectedCom = (Entities.Company)cboxCompanies.SelectedValue;

                companies.Remove(selectedCom);

                WireUp();
            }

            MessageBox.Show("EMPRESA SELECCIONADA: " + selectedCom.NameCom);
        }
Ejemplo n.º 5
0
        public Company GetById(int id)
        {
            Company company = new Company();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                using (SqlCommand command = new SqlCommand("uspGetCompanyById", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    SqlParameter parameter = new SqlParameter("@CompanyId", SqlDbType.Int) {Value = id};
                    command.Parameters.Add(parameter);

                    connection.Open();
                    var reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                    while (reader.Read())
                    {
                        company = new Company
                        {
                            Id = int.Parse(reader["CompanyId"].ToString()),
                            Name = reader["Name"].ToString(),
                            Classification = (Classification) int.Parse(reader["ClassificationId"].ToString())
                        };
                    }
                }
            }

            return company;
        }
Ejemplo n.º 6
0
		public IEnumerable<Task> Can_perform_a_simple_where()
		{
			var dbname = GenerateNewDatabaseName();
			var documentStore = new DocumentStore { Url = Url + Port };
			documentStore.Initialize();
			yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname);

			var entity = new Company { Name = "Async Company #1", Id = "companies/1" };
			using (var session = documentStore.OpenAsyncSession(dbname))
			{
				session.Store(entity);
				yield return session.SaveChangesAsync();
			}

			using (var session = documentStore.OpenAsyncSession(dbname))
			{
			var query = session.Query<Company>()
						.Where(x => x.Name == "Async Company #1")
						.ToListAsync();
				yield return query;

				Assert.AreEqual(1, query.Result.Count);
				Assert.AreEqual("Async Company #1", query.Result[0].Name);
			}
		}
Ejemplo n.º 7
0
 public ReferenceService_ec(Company factoryCompany)
 {
     swriter = new StringWriter();
     WType = new WmsTypes();
     ds = new DataSet();
     CurCompany = factoryCompany;            
 
 }
 public DocumentService_ec(Company factoryCompany)
 {
     // initialization 
     swriter = new StringWriter();
     WType = new WmsTypes();
     ds = new DataSet();
     CurCompany = factoryCompany;
 }
Ejemplo n.º 9
0
        public IList<Company> Select(Company data)
        {

                IList<Company> datos = new List<Company>();

                datos = GetHsql(data).List<Company>();
                if (!Factory.IsTransactional)
                    Factory.Commit();
                return datos;
            
        }
Ejemplo n.º 10
0
 public void TestConnection(Company data)
 {
     try
     {
         SqlConnection gpConnect = new SqlConnection(data.ErpConnection.CnnString);
         gpConnect.Open();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 11
0
        // UNITS
        public Boolean GetErpAllUnits(Company company)
        {
            if (company == null)
            {
                ExceptionMngr.WriteEvent("GetErpAllUnits Company " + company.Name, ListValues.EventType.Fatal, null, null, ListValues.ErrorCategory.Business);
                return false;
            }

            SetConnectMngr(company);

            ProcessUnits(ErpFactory.References().GetAllUnits());
            return true;
        }
Ejemplo n.º 12
0
        public Boolean GetErpReceivingDocumentsLastXDays(Company company, int days)
        {

            if (company == null)
            {
                ExceptionMngr.WriteEvent("GetErpReceivingDocumentsLastXDays Company " + company.Name, ListValues.EventType.Fatal, null, null, ListValues.ErrorCategory.Business);
                return false;
            }


            SetConnectMngr(company);

            ProcessDocuments(ErpFactory.Documents().GetReceivingDocumentsLastXDays(days), company); return true;
        }
Ejemplo n.º 13
0
        public void TestConnection(Company company)
        {
            if (ErpFactory == null)
                SetConnectMngr(company);

            try
            {
                ErpFactory.References().TestConnection(company);
            }
            catch (Exception ex)
            {
                throw new Exception(WriteLog.GetTechMessage(ex));
            }
        }
Ejemplo n.º 14
0
        public DocumentService(Company factoryCompany)
        {
            CurCompany = factoryCompany;
            WType = new WmsTypes();

            if (ErpSetup == null)
                ErpSetup = WType.GetConnectionErpSetup(new ConnectionErpSetup
                {
                    EntityType = CnnEntityType.Documents,
                    ConnectionTypeID = CnnType.UnoEE
                });

            Separator = GetErpQuery("DSEPARATOR");
        }
Ejemplo n.º 15
0
        public ReferenceService(Company factoryCompany)
        {
            CurCompany = factoryCompany;
            WType = new WmsTypes();
            ds = new DataSet();

            if (ErpSetup == null)
                ErpSetup = WType.GetConnectionErpSetup(new ConnectionErpSetup
                {
                    EntityType = CnnEntityType.References,
                    ConnectionTypeID =  CnnType.UnoEE 
                });

            Separator = GetErpQuery("SEPARATOR");

        }
Ejemplo n.º 16
0
        public Boolean GetErpReceivingDocumentsSince(Company company, DateTime sinceDate)
        {

            if (company == null)
            {
                ExceptionMngr.WriteEvent("GetErpReceivingDocumentsSince Company " + company.Name, ListValues.EventType.Fatal, null, null, ListValues.ErrorCategory.Business);
                return false;
            }


            SetConnectMngr(company);

            ProcessDocuments(ErpFactory.Documents().GetReceivingDocumentsSince(sinceDate), company);

            Console.WriteLine("GetPurchaseReturns");
            try { ProcessDocuments(ErpFactory.Documents().GetPurchaseReturnsSince(sinceDate), company); }
            catch (Exception ex) { Console.WriteLine(ex.Message); }

            return true;
        }
Ejemplo n.º 17
0
        public void SetConnectMngr(Company company)
        {
            if (ErpFactory == null)
            {
                ErpFactory = ConnectFactory.getConnectFactory(company);

                try
                {
                    historicDays = int.Parse(Factory.DaoConfigOptionByCompany()
                        .Select( new ConfigOptionByCompany
                                {
                                    ConfigOption = new ConfigOption { Code = "QUERYDAYS" },
                                    Company = company,
                                }
                        ).FirstOrDefault().Value);
                }
                catch { historicDays = WmsSetupValues.HistoricDays; }

            }
        }
Ejemplo n.º 18
0
        public Boolean GetErpAllReceivingDocuments(Company company)
        {

            if (company == null)
            {
                ExceptionMngr.WriteEvent("GetErpAllReceivingDocuments Company " + company.Name, ListValues.EventType.Fatal, null, null, ListValues.ErrorCategory.Business);
                return false;
            }

            SetConnectMngr(company);


            Console.WriteLine("Running RecDoc");


            //ProcessDocuments(ErpFactory.Documents().GetAllReceivingDocuments()); //return true;
            ProcessDocuments(ErpFactory.Documents().GetReceivingDocumentsSince(DateTime.Today.AddDays(-1 * this.historicDays)), company);
            ProcessDocuments(ErpFactory.Documents().GetPurchaseReturnsSince(DateTime.Today.AddDays(-1 * this.historicDays)), company);



            return true;

        }
Ejemplo n.º 19
0
 public string GetCompanyOption(Company company, string code)
 {
     try
     {
         return Factory.DaoConfigOptionByCompany().Select(new ConfigOptionByCompany
         {
             Company = company,
             ConfigOption = new ConfigOption { Code = code }
         }).First().Value;
     }
     catch { return ""; }
 }
Ejemplo n.º 20
0
        public void IncreaseOption(string option, Company company)
        {
            try
            {
                ConfigOption cfg = Factory.DaoConfigOption().Select(new ConfigOption { Code = option }).First();
                cfg.DefValue = (int.Parse(cfg.DefValue) + 1).ToString();
                Factory.DaoConfigOption().Update(cfg);
            }
            catch { }


            try
            {
                ConfigOptionByCompany cfg = Factory.DaoConfigOptionByCompany().Select(
                    new ConfigOptionByCompany
                    {
                        Company = company,
                        ConfigOption = new ConfigOption { Code = option }
                    }).First();

                cfg.Value = (int.Parse(cfg.Value) + 1).ToString();
                Factory.DaoConfigOptionByCompany().Update(cfg);
            }
            catch { }

        }
Ejemplo n.º 21
0
 public DocumentTypeSequence GetNextDocSequence(Company company, DocumentType docType)
 {
     return BasicMngr.GetNextDocSequence(company, docType);
 }
Ejemplo n.º 22
0
 public string GetCompanyOption(Company company, string code)
 {
     return BasicMngr.GetCompanyOption(company, code);
 }
Ejemplo n.º 23
0
 public void RunDataBaseRoutines(Company company)
 {
     WorkFlowRuntime.DataBaseRoutines();
 }
Ejemplo n.º 24
0
 public void GetErpKitAssemblyDocumentsSince(Company company, DateTime since)
 {
     ErpMngr.GetErpKitAssemblyDocumentsSince(company, since);
 }
Ejemplo n.º 25
0
 public void GetErpAllKitAssemblyDocuments(Company company)
 {
     ErpMngr.GetErpAllKitAssemblyDocuments(company);
 }
Ejemplo n.º 26
0
 public void GetErpAllKitAssembly(Company company)
 {
     ErpMngr.GetErpAllKitAssembly(company);
 }
Ejemplo n.º 27
0
 public void DeleteCompany(Company data) { Factory.DaoCompany().Delete(data); }
Ejemplo n.º 28
0
 public void UpdateCompany(Company data) { Factory.DaoCompany().Update(data); }
Ejemplo n.º 29
0
 public Company SaveCompany(Company data) { return Factory.DaoCompany().Save(data); }
Ejemplo n.º 30
0
 public IList<Company> GetCompany(Company data) { return Factory.DaoCompany().Select(data); }
Ejemplo n.º 31
0
 public void UpdateWMSStockFromERP(Company company, bool detailed)
 {
     ErpMngr.UpdateWMSStockFromERP(company, detailed);
 }