public static DataSet GetAllPurchaseOrder(PurchaseOrder_StatusEnum status)
        {
            DBAccess db = new DBAccess();

            db.AddInt("status", System.Convert.ToInt32(status));
            DataSet ds = db.ExecuteDataSet(_SQLSelectByStatus);

            return(ds);
        }
        public static DataSet GetPurchaseOrdersDS(int SupplierID, PurchaseOrder_StatusEnum Status)
        {
            DBAccess db = new DBAccess();

            db.AddInt("SupplierID", SupplierID);
            db.AddInt("Status", System.Convert.ToInt32(Status));
            DataSet ds = db.ExecuteDataSet(_SQLSelectByStatusSupplier);

            return(ds);
        }
        public static int SetStatus(int ID, PurchaseOrder_StatusEnum Status)
        {
            DBAccess db = new DBAccess();

            PurchaseOrder c = new PurchaseOrder(ID);

            db.AddInt("ID", ID);
            db.AddInt("Status", System.Convert.ToInt32(Status));
            AddParmsStandard(db, c);

            int retval = db.ExecuteNonQuery(_SQLSetStatus);

            AddLog(Status: "PurchaseOrder", Logtext: string.Format("SetStatus PurchaseOrder: ID:{0} Status:{1}", c.ID, c.StatusText), Metode: "SetStatus");
            return(retval);
        }
        //EXEC	@return_value = [vicjos1_sysadm].[Co2Db_PurchaseOrder_Search]
        //		@SupplierID = -1,
        //		@PurchaseOrderID = -1,
        //		@Status = -1,
        //		@StartDate = NULL,
        //		@EndDate = NULL
        public static DataSet GetPurchaseOrdersSupplierDS(int SupplierID, PurchaseOrder_StatusEnum Status, int PurchaseOrderID, string StartDate, string EndDate)
        {
            DBAccess db = new DBAccess();

            db.AddInt("SupplierID", SupplierID);
            db.AddInt("PurchaseOrderID", PurchaseOrderID);
            db.AddInt("Status", System.Convert.ToInt32(Status));
            if (Information.IsDate(StartDate))
            {
                db.AddDateTime("StartDate", (DateTime?)((object)StartDate));
            }
            if (Information.IsDate(EndDate))
            {
                db.AddDateTime("EndDate", (DateTime?)((object)EndDate));
            }
            DataSet ds = db.ExecuteDataSet(_SQLSelectBySupplierSearch);

            return(ds);
        }
 public static DataSet GetPurchaseOrderSupplierStatus(int SupplierID, PurchaseOrder_StatusEnum type)
 {
     return(Search_PurchaseOrder((System.Convert.ToInt32(type)).ToString(), SupplierID));
 }
 public static DataSet GetRekvireret_PurchaseOrder(PurchaseOrder_StatusEnum type)
 {
     return(Search_PurchaseOrder((System.Convert.ToInt32(type)).ToString()));
 }
        public static System.Collections.Generic.List <PurchaseOrder> GetPurchaseOrdersList(int SupplierID, PurchaseOrder_StatusEnum Status)
        {
            System.Collections.Generic.List <PurchaseOrder> result = new System.Collections.Generic.List <PurchaseOrder>();
            DBAccess      db  = new DBAccess();
            PurchaseOrder rec = default(PurchaseOrder);

            db.AddInt("SupplierID", SupplierID);
            db.AddInt("Status", System.Convert.ToInt32(Status));

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectByStatusSupplier));  //_SQLSelectAll 'CType(db.ExecuteReader(_SQLSelectAllID), SqlDataReader)
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        rec = new PurchaseOrder();
                        Populate(dr, rec);
                        result.Add(rec); //(PurchaseOrder.GetPurchaseOrder(dr.DBtoInt("ID")))
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }