Esempio n. 1
0
 public void DeleteShippingMethod(ShippingMethod data) { Factory.DaoShippingMethod().Delete(data); }
Esempio n. 2
0
 public ShippingMethod SaveShippingMethod(ShippingMethod data) { return Factory.DaoShippingMethod().Save(data); }
Esempio n. 3
0
 public void UpdateShippingMethod(ShippingMethod data) { Factory.DaoShippingMethod().Update(data); }
Esempio n. 4
0
 public IList<ShippingMethod> GetShippingMethod(ShippingMethod data) { return Factory.DaoShippingMethod().Select(data); }
Esempio n. 5
0
        public IList<ShippingMethod> GetAllShippingMethods()
        {
            ShippingMethod tmpData;
            IList<ShippingMethod> list = new List<ShippingMethod>();

            try
            {

                Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString);

                Query = " select DELIV_CODE, DELIV_DESC from DEL_MTHD where ACTIVE ='T' ";

                ds = ReturnDataSet(Query, "", "DEL_MTHD", Command.Connection);

                if (ds == null || ds.Tables.Count == 0)
                    return null;

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //Map Properties
                    tmpData = new ShippingMethod();

                    tmpData.Company = CurCompany;
                    tmpData.Name = dr["DELIV_DESC"].ToString();
                    tmpData.ErpCode = dr["DELIV_CODE"].ToString();
                    tmpData.IsFromErp = true;

                    list.Add(tmpData);

                }
                
                return list;
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetAllShippingMethods", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return null;
            }
        }
Esempio n. 6
0
        //SHIPPING METHODS
        /// <summary>
        /// Get Shipping Methods from Dynamics GP
        /// </summary>
        /// <returns></returns>
        public IList<ShippingMethod> GetAllShippingMethods()
        {

            ShippingMethod tmpData;
            IList<ShippingMethod> list = new List<ShippingMethod>();

            try
            {
                //Lamar los documents que necesita del Erp usando econnect
                ds = DynamicsGP_ec.GetDataSet(DynamicsGP_ec.RetreiveData("WSShippingMethod", false, 2, 0, "", true));
                
                if (ds.Tables.Count == 0)
                    return null;

                //En el dataset, Tables: 1 - Methods
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    //Map Properties
                    tmpData = new ShippingMethod();

                    tmpData.Company = CurCompany;
                    tmpData.Name = dr["SHIPMTHD"].ToString() + ", " + dr["SHMTHDSC"].ToString();
                    tmpData.ErpCode = dr["SHIPMTHD"].ToString();
                    tmpData.IsFromErp = true;

                    list.Add(tmpData);

                }

                return list;
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetAllShippingMethods", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return null; 
            }
        }
        private void ProcessShippingMethods(IList<ShippingMethod> list)
        {
            if (list == null)
                return;

            ShippingMethod curShp;



            foreach (ShippingMethod e in list)
            {
                try
                {

                    curShp = new ShippingMethod();
                    curShp.Company = e.Company;
                    curShp.ErpCode = e.ErpCode;


                    //Evalua si el elemento ya existe 
                    IList<ShippingMethod> exList = Factory.DaoShippingMethod().Select(curShp);
                    e.ModDate = DateTime.Now;
                    e.ModifiedBy = WmsSetupValues.SystemUser;

                    if (exList.Count == 0)
                    {
                        e.CreationDate = DateTime.Now;
                        e.CreatedBy = WmsSetupValues.SystemUser;
                        Factory.DaoShippingMethod().Save(e);
                    }
                    else
                    {
                        e.ShpMethodID = exList.First().ShpMethodID;
                        e.CreatedBy = exList.First().CreatedBy;
                        e.CreationDate = exList.First().CreationDate;
                        Factory.DaoShippingMethod().Update(e);
                    }

                }
                catch (Exception ex)
                {
                    Factory.Rollback();
                    ExceptionMngr.WriteEvent("ProcessShippingMethods:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business);
                    //throw;
                }
            }

        }
Esempio n. 8
0
 public ShippingMethod GetShippingMethod(ShippingMethod data)
 {
     return Factory.DaoShippingMethod().Select(data).First();
 }