예제 #1
0
        public virtual bool AddSupplierAgentProtocal(SupplierAgentProtocalInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

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

            DrAdd["Protocal_ID"]         = entity.Protocal_ID;
            DrAdd["Protocal_Code"]       = entity.Protocal_Code;
            DrAdd["Protocal_PurchaseID"] = entity.Protocal_PurchaseID;
            DrAdd["Protocal_SupplierID"] = entity.Protocal_SupplierID;
            DrAdd["Protocal_Status"]     = entity.Protocal_Status;
            DrAdd["Protocal_Template"]   = entity.Protocal_Template;
            DrAdd["Protocal_Addtime"]    = entity.Protocal_Addtime;
            DrAdd["Protocal_Site"]       = entity.Protocal_Site;

            DtAdd.Rows.Add(DrAdd);
            try
            {
                DBHelper.SaveChanges(SqlAdd, DtAdd);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
        }
예제 #2
0
 public virtual bool EditSupplierAgentProtocal(SupplierAgentProtocalInfo entity, RBACUserInfo UserPrivilege)
 {
     if (RBAC.CheckPrivilege(UserPrivilege, "7abc095a-d322-4312-861c-aecb6088c3bb"))
     {
         return(MyDAL.EditSupplierAgentProtocal(entity));
     }
     else
     {
         throw new TradePrivilegeException("没有权限,权限代码:7abc095a-d322-4312-861c-aecb6088c3bb错误");
     }
 }
예제 #3
0
 public virtual bool AddSupplierAgentProtocal(SupplierAgentProtocalInfo entity, RBACUserInfo UserPrivilege)
 {
     if (RBAC.CheckPrivilege(UserPrivilege, "e0920e95-65fa-4e3c-9dd6-2794ccc45782"))
     {
         return(MyDAL.AddSupplierAgentProtocal(entity));
     }
     else
     {
         throw new TradePrivilegeException("没有权限,权限代码:e0920e95-65fa-4e3c-9dd6-2794ccc45782错误");
     }
 }
예제 #4
0
        public virtual IList <SupplierAgentProtocalInfo> GetSupplierAgentProtocals(QueryInfo Query)
        {
            int PageSize;
            int CurrentPage;
            IList <SupplierAgentProtocalInfo> entitys = null;
            SupplierAgentProtocalInfo         entity = null;
            string        SqlList, SqlField, SqlOrder, SqlParam, SqlTable;
            SqlDataReader RdrList = null;

            try
            {
                CurrentPage = Query.CurrentPage;
                PageSize    = Query.PageSize;
                SqlTable    = "Supplier_Agent_Protocal";
                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 <SupplierAgentProtocalInfo>();
                    while (RdrList.Read())
                    {
                        entity                     = new SupplierAgentProtocalInfo();
                        entity.Protocal_ID         = Tools.NullInt(RdrList["Protocal_ID"]);
                        entity.Protocal_Code       = Tools.NullStr(RdrList["Protocal_Code"]);
                        entity.Protocal_PurchaseID = Tools.NullInt(RdrList["Protocal_PurchaseID"]);
                        entity.Protocal_SupplierID = Tools.NullInt(RdrList["Protocal_SupplierID"]);
                        entity.Protocal_Status     = Tools.NullInt(RdrList["Protocal_Status"]);
                        entity.Protocal_Template   = Tools.NullStr(RdrList["Protocal_Template"]);
                        entity.Protocal_Addtime    = Tools.NullDate(RdrList["Protocal_Addtime"]);
                        entity.Protocal_Site       = Tools.NullStr(RdrList["Protocal_Site"]);

                        entitys.Add(entity);
                        entity = null;
                    }
                }
                return(entitys);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }
예제 #5
0
        public virtual bool EditSupplierAgentProtocal(SupplierAgentProtocalInfo entity)
        {
            string    SqlAdd = null;
            DataTable DtAdd  = null;
            DataRow   DrAdd  = null;

            SqlAdd = "SELECT * FROM Supplier_Agent_Protocal WHERE Protocal_ID = " + entity.Protocal_ID;
            DtAdd  = DBHelper.Query(SqlAdd);
            try
            {
                if (DtAdd.Rows.Count > 0)
                {
                    DrAdd = DtAdd.Rows[0];
                    DrAdd["Protocal_ID"]         = entity.Protocal_ID;
                    DrAdd["Protocal_Code"]       = entity.Protocal_Code;
                    DrAdd["Protocal_PurchaseID"] = entity.Protocal_PurchaseID;
                    DrAdd["Protocal_SupplierID"] = entity.Protocal_SupplierID;
                    DrAdd["Protocal_Status"]     = entity.Protocal_Status;
                    DrAdd["Protocal_Template"]   = entity.Protocal_Template;
                    DrAdd["Protocal_Addtime"]    = entity.Protocal_Addtime;
                    DrAdd["Protocal_Site"]       = entity.Protocal_Site;

                    DBHelper.SaveChanges(SqlAdd, DtAdd);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DtAdd.Dispose();
            }
            return(true);
        }
예제 #6
0
        public virtual SupplierAgentProtocalInfo GetSupplierAgentProtocalByPurchaseID(int PurchaseID)
        {
            SupplierAgentProtocalInfo entity  = null;
            SqlDataReader             RdrList = null;

            try
            {
                string SqlList;
                SqlList = "SELECT * FROM Supplier_Agent_Protocal WHERE Protocal_PurchaseID = " + PurchaseID;
                RdrList = DBHelper.ExecuteReader(SqlList);
                if (RdrList.Read())
                {
                    entity = new SupplierAgentProtocalInfo();

                    entity.Protocal_ID         = Tools.NullInt(RdrList["Protocal_ID"]);
                    entity.Protocal_Code       = Tools.NullStr(RdrList["Protocal_Code"]);
                    entity.Protocal_PurchaseID = Tools.NullInt(RdrList["Protocal_PurchaseID"]);
                    entity.Protocal_SupplierID = Tools.NullInt(RdrList["Protocal_SupplierID"]);
                    entity.Protocal_Status     = Tools.NullInt(RdrList["Protocal_Status"]);
                    entity.Protocal_Template   = Tools.NullStr(RdrList["Protocal_Template"]);
                    entity.Protocal_Addtime    = Tools.NullDate(RdrList["Protocal_Addtime"]);
                    entity.Protocal_Site       = Tools.NullStr(RdrList["Protocal_Site"]);
                }

                return(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RdrList != null)
                {
                    RdrList.Close();
                    RdrList = null;
                }
            }
        }