示例#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;
            }
        }
示例#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;

        }
		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);
			}
		}
示例#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);
        }
示例#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;
        }
示例#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);
			}
		}
示例#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;
 }
示例#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;
            
        }
示例#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);
     }
 }
示例#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;
        }
示例#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;
        }
示例#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));
            }
        }
        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");
        }
示例#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");

        }
示例#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;
        }
示例#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; }

            }
        }
示例#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;

        }
示例#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 ""; }
 }
示例#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 { }

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