示例#1
0
        public virtual bool AddSupplierPurchaseDetail(SupplierPurchaseDetailInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT TOP 0 * FROM Supplier_Purchase_Detail";
            DtAdd  = DBHelper.Query(SqlAdd);
            DrAdd  = DtAdd.NewRow();

            DrAdd["Detail_ID"]         = entity.Detail_ID;
            DrAdd["Detail_PurchaseID"] = entity.Detail_PurchaseID;
            DrAdd["Detail_Name"]       = entity.Detail_Name;
            DrAdd["Detail_Spec"]       = entity.Detail_Spec;
            DrAdd["Detail_Amount"]     = entity.Detail_Amount;
            DrAdd["Detail_Price"]      = entity.Detail_Price;

            DtAdd.Rows.Add(DrAdd);
            try
            {
                DBHelper.SaveChanges(SqlAdd, DtAdd);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
        }
示例#2
0
        public virtual IList <SupplierPurchaseDetailInfo> GetSupplierPurchaseDetails(QueryInfo Query)
        {
            int PageSize;
            int CurrentPage;
            IList <SupplierPurchaseDetailInfo> entitys = null;
            SupplierPurchaseDetailInfo         entity = null;
            string        SqlList, SqlField, SqlOrder, SqlParam, SqlTable;
            SqlDataReader RdrList = null;

            try
            {
                CurrentPage = Query.CurrentPage;
                PageSize    = Query.PageSize;
                SqlTable    = "Supplier_Purchase_Detail";
                SqlField    = "*";
                SqlParam    = DBHelper.GetSqlParam(Query.ParamInfos);
                SqlOrder    = DBHelper.GetSqlOrder(Query.OrderInfos);
                SqlList     = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize);
                RdrList     = DBHelper.ExecuteReader(SqlList);
                if (RdrList.HasRows)
                {
                    entitys = new List <SupplierPurchaseDetailInfo>();
                    while (RdrList.Read())
                    {
                        entity                   = new SupplierPurchaseDetailInfo();
                        entity.Detail_ID         = Tools.NullInt(RdrList["Detail_ID"]);
                        entity.Detail_PurchaseID = Tools.NullInt(RdrList["Detail_PurchaseID"]);
                        entity.Detail_Name       = Tools.NullStr(RdrList["Detail_Name"]);
                        entity.Detail_Spec       = Tools.NullStr(RdrList["Detail_Spec"]);
                        entity.Detail_Amount     = Tools.NullInt(RdrList["Detail_Amount"]);
                        entity.Detail_Price      = Tools.NullDbl(RdrList["Detail_Price"]);

                        entitys.Add(entity);
                        entity = null;
                    }
                }
                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
示例#3
0
        public virtual IList <SupplierPurchaseDetailInfo> GetSupplierPurchaseDetailsByPurchaseID(int Apply_ID)
        {
            IList <SupplierPurchaseDetailInfo> entitys = null;
            SupplierPurchaseDetailInfo         entity  = null;
            string        SqlList;
            SqlDataReader RdrList = null;

            try
            {
                SqlList = "select * from Supplier_Purchase_Detail where Detail_PurchaseID=" + Apply_ID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.HasRows)
                {
                    entitys = new List <SupplierPurchaseDetailInfo>();
                    while (RdrList.Read())
                    {
                        entity                   = new SupplierPurchaseDetailInfo();
                        entity.Detail_ID         = Tools.NullInt(RdrList["Detail_ID"]);
                        entity.Detail_PurchaseID = Tools.NullInt(RdrList["Detail_PurchaseID"]);
                        entity.Detail_Name       = Tools.NullStr(RdrList["Detail_Name"]);
                        entity.Detail_Spec       = Tools.NullStr(RdrList["Detail_Spec"]);
                        entity.Detail_Amount     = Tools.NullInt(RdrList["Detail_Amount"]);
                        entity.Detail_Price      = Tools.NullDbl(RdrList["Detail_Price"]);

                        entitys.Add(entity);
                        entity = null;
                    }
                }
                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
示例#4
0
        public virtual SupplierPurchaseDetailInfo GetSupplierPurchaseDetailByID(int ID)
        {
            SupplierPurchaseDetailInfo entity = null;
            SqlDataReader RdrList             = null;

            try
            {
                string SqlList;
                SqlList = "SELECT * FROM Supplier_Purchase_Detail WHERE Detail_ID = " + ID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.Read())
                {
                    entity = new SupplierPurchaseDetailInfo();

                    entity.Detail_ID         = Tools.NullInt(RdrList["Detail_ID"]);
                    entity.Detail_PurchaseID = Tools.NullInt(RdrList["Detail_PurchaseID"]);
                    entity.Detail_Name       = Tools.NullStr(RdrList["Detail_Name"]);
                    entity.Detail_Spec       = Tools.NullStr(RdrList["Detail_Spec"]);
                    entity.Detail_Amount     = Tools.NullInt(RdrList["Detail_Amount"]);
                    entity.Detail_Price      = Tools.NullDbl(RdrList["Detail_Price"]);
                }

                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
示例#5
0
        public virtual bool EditSupplierPurchaseDetail(SupplierPurchaseDetailInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT * FROM Supplier_Purchase_Detail WHERE Detail_ID = " + entity.Detail_ID;
            DtAdd  = DBHelper.Query(SqlAdd);
            try
            {
                if (DtAdd.Rows.Count > 0)
                {
                    DrAdd = DtAdd.Rows[0];
                    DrAdd["Detail_ID"]         = entity.Detail_ID;
                    DrAdd["Detail_PurchaseID"] = entity.Detail_PurchaseID;
                    DrAdd["Detail_Name"]       = entity.Detail_Name;
                    DrAdd["Detail_Spec"]       = entity.Detail_Spec;
                    DrAdd["Detail_Amount"]     = entity.Detail_Amount;
                    DrAdd["Detail_Price"]      = entity.Detail_Price;

                    DBHelper.SaveChanges(SqlAdd, DtAdd);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
            return(true);
        }
示例#6
0
 public virtual bool EditSupplierPurchaseDetail(SupplierPurchaseDetailInfo entity)
 {
     return(MyDAL.EditSupplierPurchaseDetail(entity));
 }