Пример #1
0
        public IList<KitAssemblyFormula> Select(KitAssemblyFormula data)
        {
                IList<KitAssemblyFormula> datos = new List<KitAssemblyFormula>();

                datos = GetHsql(data).List<KitAssemblyFormula>();
                if (!Factory.IsTransactional)
                    Factory.Commit();
                return datos;

        }
Пример #2
0
 public void UpdateKitAssemblyFormula(KitAssemblyFormula data) { Factory.DaoKitAssemblyFormula().Update(data); }
Пример #3
0
 public void DeleteKitAssemblyFormula(KitAssemblyFormula data) { Factory.DaoKitAssemblyFormula().Delete(data); }
Пример #4
0
 public KitAssemblyFormula SaveKitAssemblyFormula(KitAssemblyFormula data) { return Factory.DaoKitAssemblyFormula().Save(data); }
Пример #5
0
 public IList<KitAssemblyFormula> GetKitAssemblyFormula(KitAssemblyFormula data) { return Factory.DaoKitAssemblyFormula().Select(data); }
Пример #6
0
        public IList<KitAssemblyFormula> GetKitAssemblyFormula(string sWhere)
        {
            //retorna la lista de Formulas.

            KitAssemblyFormula tmpData = null;
            try
            {
                Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString);

                Query = "select KIT_CODE, ITEM_CODE, ITEM_QTY from X_KIT WHERE DESC_TYPE=1  ";
                DataSet ds = ReturnDataSet(Query, sWhere, "X_KIT", Command.Connection);

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


                List<KitAssemblyFormula> list = new List<KitAssemblyFormula>();
                Status statusOK = WType.GetStatus(new Status { StatusID = EntityStatus.Active });
                Status statusInactive = WType.GetStatus(new Status { StatusID = EntityStatus.Inactive });

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

                        tmpData.KitAssembly = WType.GetKitAssembly(new KitAssembly { Product = new Product { Company = CurCompany, ProductCode = dr["KIT_CODE"].ToString() } });
                        tmpData.Status = statusOK;
                        tmpData.EfectiveDate = DateTime.Now;
                        tmpData.ObsoleteDate = DateTime.Now;
                        tmpData.Component = WType.GetProduct(new Product { Company = CurCompany, ProductCode = dr["ITEM_CODE"].ToString() });
                        tmpData.Unit = tmpData.Component.BaseUnit;
                        tmpData.FormulaQty = Double.Parse(dr["ITEM_QTY"].ToString()); ;
                        tmpData.Ord = 1;
                        tmpData.ScrapPercent = 0;
                        tmpData.DirectProduct = WType.GetProduct(new Product { Company = CurCompany, ProductCode = dr["KIT_CODE"].ToString() });

                        list.Add(tmpData);

                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetKitAssemblyFormula:" + tmpData.KitAssembly.Product.ProductCode + ", " + tmpData.Component.ProductCode, ListValues.EventType.Error, ex, null,
                            ListValues.ErrorCategory.ErpConnection);

                        return null;
                    }
                }


                return list;

            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetKitAssemblyFormula:", ListValues.EventType.Error, ex, null,
                    ListValues.ErrorCategory.ErpConnection);

                return null;
            }


        }
Пример #7
0
        public IList<KitAssemblyFormula> GetKitAssemblyFormula(string sWhere)
        {
            //retorna la lista de Formulas.

            KitAssemblyFormula tmpData = null;
            try
            {
                Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString);

                // BM00101 - KitAssemblyHeader
                DataSet ds = ReturnDataSet("SELECT * FROM BM00111 WHERE Bill_Status = 1 AND Component_Status=1 ", sWhere, "BM00111", Command.Connection);


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


                List<KitAssemblyFormula> list = new List<KitAssemblyFormula>();
                Status statusOK = WType.GetStatus(new Status { StatusID = EntityStatus.Active });
                Status statusInactive = WType.GetStatus(new Status { StatusID = EntityStatus.Inactive });

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

                        tmpData.KitAssembly = WType.GetKitAssembly(new KitAssembly { Product = new Product { Company = CurCompany, ProductCode = dr["ITEMNMBR"].ToString() } });
                        tmpData.Status = (dr["Component_Status"].ToString() == "1") ? statusOK : statusInactive;
                        tmpData.EfectiveDate = DateTime.Parse(dr["Effective_Date"].ToString());
                        tmpData.ObsoleteDate = DateTime.Parse(dr["Obsolete_Date"].ToString());
                        tmpData.Component = WType.GetProduct(new Product { Company = CurCompany, ProductCode = dr["CMPTITNM"].ToString() });
                        tmpData.Unit = WType.GetUnit(new Unit { ErpCode = dr["UOFM"].ToString(), ErpCodeGroup = tmpData.Component.BaseUnit.ErpCodeGroup });
                        tmpData.FormulaQty = Double.Parse(dr["Design_Qty"].ToString()); ;
                        tmpData.Ord = int.Parse(dr["ORD"].ToString()); ;
                        tmpData.ScrapPercent = Double.Parse(dr["Scrap_Percentage"].ToString());
                        tmpData.DirectProduct = WType.GetProduct(new Product { Company = CurCompany, ProductCode = dr["ITEMNMBR"].ToString() });

                        list.Add(tmpData);

                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetKitAssemblyFormula:" + tmpData.KitAssembly.Product.ProductCode + ", " + tmpData.Component.ProductCode, ListValues.EventType.Error, ex, null,
                            ListValues.ErrorCategory.ErpConnection);

                        return null;
                    }
                }


                return list;

            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetKitAssemblyFormula:", ListValues.EventType.Error, ex, null,
                    ListValues.ErrorCategory.ErpConnection);

                return null;
            }


        }
Пример #8
0
 public KitAssemblyFormula SelectById(KitAssemblyFormula data)
 {
     return (KitAssemblyFormula)base.SelectById(data);
 }
Пример #9
0
 public Boolean Delete(KitAssemblyFormula data)
 {
     return base.Delete(data);
 }
Пример #10
0
 public Boolean Update(KitAssemblyFormula data)
 {
     return base.Update(data);
 }
Пример #11
0
 public KitAssemblyFormula Save(KitAssemblyFormula data)
 {
     return (KitAssemblyFormula)base.Save(data);
 }