Пример #1
0
        public bool SetBind(TemplateBindType type, int bindId, string templatePath)
        {
            int rowcount;

            if (!HasExists(type, bindId))
            {
                rowcount = base.ExecuteNonQuery(
                    new SqlQuery(base.OptimizeSQL(SP.TplBind_Add),
                                 new object[, ] {
                    { "@bindId", bindId },
                    { "@bindType", (int)type },
                    { "@tplPath", templatePath }
                }));
            }
            else
            {
                //如果模板为空,则删除
                if (String.IsNullOrEmpty(templatePath))
                {
                    return(RemoveBind(type, bindId));
                }
                else
                {
                    rowcount = base.ExecuteNonQuery(
                        new SqlQuery(base.OptimizeSQL(SP.TplBind_Update),
                                     new object[, ] {
                        { "@tplPath", templatePath },
                        { "@bindId", bindId },
                        { "@bindType", (int)type }
                    }));
                }
            }

            return(rowcount == 1);
        }
Пример #2
0
        internal bool RemoveBind(TemplateBindType type, string bindID)
        {
            bool result = dal.RemoveBind(type, bindID);

            //WeakRefCache.RebuiltTemplateBind();
            return(result);
        }
Пример #3
0
        public Error RemoveBind(int refrenceId, TemplateBindType templateBindType)
        {
            bool result = tpldal.RemoveBind(templateBindType, refrenceId);

            RepositoryDataCache.ClearTemplateBinds();
            return(null);
        }
Пример #4
0
        public bool SetBind(TemplateBindType type, int bindId, string templatePath)
        {
            int rowcount;

            //如果模板为空,则删除
            if (String.IsNullOrEmpty(templatePath))
            {
                return(RemoveBind(type, bindId));
            }

            var paramsters = base.Db.CreateParametersFromArray(
                new object[, ]
            {
                { "@tplPath", templatePath },
                { "@bindId", bindId },
                { "@bindType", (int)type }
            });

            if (!HasExists(type, bindId))
            {
                rowcount = base.ExecuteNonQuery(
                    base.NewQuery(DbSql.TplBind_Add, paramsters));
            }
            else
            {
                rowcount = base.ExecuteNonQuery(
                    base.NewQuery(DbSql.TplBind_Update, paramsters)
                    );
            }

            return(rowcount == 1);
        }
Пример #5
0
        public bool SetBind(TemplateBindType type,int bindId,string templatePath)
        {
            int rowcount;
            if (!HasExists(type, bindId))
            {
                rowcount = base.ExecuteNonQuery(
                     new SqlQuery(base.OptimizeSQL(SP.TplBind_Add),
                         new object[,]{
                     {"@bindId", bindId},
                     {"@bindType",(int)type},
                    {"@tplPath",templatePath}
                         }));
            }
            else
            {
                //如果模板为空,则删除
                if (String.IsNullOrEmpty(templatePath))
                {
                    return RemoveBind(type, bindId);
                }
                else
                {
                    rowcount = base.ExecuteNonQuery(
                         new SqlQuery(base.OptimizeSQL(SP.TplBind_Update),
                             new object[,]{
                        {"@tplPath",templatePath},
                         {"@bindId",bindId},
                         {"@bindType",(int)type}
                             }));
                }
            }

            return rowcount == 1;
        }
Пример #6
0
        //private TemplateBind GetBind(TemplateBindType type, string bindID)
        //{
        //    TemplateBind entity = null;
        //    base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.TplBind_GetBind),
        //        new object[,]{
        //          {"@bindId", bindID},
        //          {"@bindType", type}
        //        }),
        //          reader =>
        //          {
        //              if (reader.HasRows)
        //              {
        //                  entity = reader.ToEntity<TemplateBind>();
        //              }
        //          });
        //    return entity;
        //}


        public bool RemoveBind(TemplateBindType type, int bindRefrenceId)
        {
            return(base.ExecuteNonQuery(
                       base.NewQuery(DbSql.TplBind_RemoveBind, base.Db.CreateParametersFromArray(
                                         new object[, ] {
                { "@bindId", bindRefrenceId },
                { "@bindType", type }
            }))) == 1);
        }
Пример #7
0
 private ITemplateBind GetBind(TemplateBindType templateBindType, int bindRefrenceId)
 {
     foreach (ITemplateBind bind in this.TemplateBinds)
     {
         if (bind.BindType == templateBindType && bind.BindRefrenceId == bindRefrenceId)
             return bind;
     }
     return null;
 }
Пример #8
0
        //private TemplateBind GetBind(TemplateBindType type, string bindID)
        //{
        //    TemplateBind entity = null;
        //    base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.TplBind_GetBind),
        //        new object[,]{
        //          {"@bindId", bindID},
        //          {"@bindType", type}
        //        }),
        //          reader =>
        //          {
        //              if (reader.HasRows)
        //              {
        //                  entity = reader.ToEntity<TemplateBind>();
        //              }
        //          });
        //    return entity;
        //}


        public bool RemoveBind(TemplateBindType type, int bindRefrenceId)
        {
            return base.ExecuteNonQuery(
                 new SqlQuery(base.OptimizeSQL(SP.TplBind_RemoveBind),
                      new object[,]{
                 {"@bindId", bindRefrenceId},
                 {"@bindType", type}
                      })) == 1;
        }
Пример #9
0
        //private TemplateBind GetBind(TemplateBindType type, string bindID)
        //{
        //    TemplateBind entity = null;
        //    base.ExecuteReader(new SqlQuery(base.OptimizeSQL(SP.TplBind_GetBind),
        //        new object[,]{
        //          {"@bindId", bindID},
        //          {"@bindType", type}
        //        }),
        //          reader =>
        //          {
        //              if (reader.HasRows)
        //              {
        //                  entity = reader.ToEntity<TemplateBind>();
        //              }
        //          });
        //    return entity;
        //}


        public bool RemoveBind(TemplateBindType type, int bindRefrenceId)
        {
            return(base.ExecuteNonQuery(
                       new SqlQuery(base.OptimizeSQL(SP.TplBind_RemoveBind),
                                    new object[, ] {
                { "@bindId", bindRefrenceId },
                { "@bindType", type }
            })) == 1);
        }
Пример #10
0
 private bool HasExists(TemplateBindType type, int bindID)
 {
     return(int.Parse(base.ExecuteScalar(
                          new SqlQuery(base.OptimizeSQL(SP.TplBind_CheckExists),
                                       new object[, ] {
         { "@bindId", bindID },
         { "@bindType", type }
     })
                          ).ToString()) != 0);
 }
Пример #11
0
 private bool HasExists(TemplateBindType type, int bindID)
 {
     return int.Parse(base.ExecuteScalar(
          new SqlQuery(base.OptimizeSQL(SP.TplBind_CheckExists),
              new object[,]{
          {"@bindId", bindID},
          {"@bindType", type}
              })
          ).ToString()) != 0;
 }
Пример #12
0
 private ITemplateBind GetBind(TemplateBindType templateBindType, int bindRefrenceId)
 {
     foreach (ITemplateBind bind in this.TemplateBinds)
     {
         if (bind.BindType == templateBindType && bind.BindRefrenceId == bindRefrenceId)
         {
             return(bind);
         }
     }
     return(null);
 }
Пример #13
0
        private bool HasExists(TemplateBindType type, int bindId)
        {
            var parameters = base.Db.CreateParametersFromArray(
                new object[, ] {
                { "@bindId", bindId },
                { "@bindType", type }
            });

            return(int.Parse(base.ExecuteScalar(
                                 base.NewQuery(DbSql.TplBind_CheckExists, parameters)
                                 ).ToString()) != 0);
        }
Пример #14
0
 internal TemplateBind(int id, TemplateBindType type, string templatePath)
 {
     this.Id       = id;
     this.BindType = type;
     this.TplPath  = templatePath;
 }
Пример #15
0
 public void RemoveBind(TemplateBindType templateBindType, int bindRefrenceId)
 {
     bool result = tpldal.RemoveBind(templateBindType, bindRefrenceId);
     RepositoryDataCache.ClearTemplateBinds();
 }
Пример #16
0
 public ITemplateBind GetTemplateBind(int bindRelationId, TemplateBindType templateBindType)
 {
     return this.GetBind(templateBindType, bindRelationId);
 }
Пример #17
0
 internal TemplateBind(int id,TemplateBindType type,string templatePath)
 {
     this.Id = id;
     this.BindType = type;
     this.TplPath = templatePath;
 }
Пример #18
0
 public TemplateBind(int id, TemplateBindType type, string templatePath)
 {
     ID       = id;
     BindType = type;
     TplPath  = templatePath;
 }
Пример #19
0
 public ITemplateBind GetTemplateBind(int bindRelationId, TemplateBindType templateBindType)
 {
     return(this.GetBind(templateBindType, bindRelationId));
 }
Пример #20
0
        public void RemoveBind(TemplateBindType templateBindType, int bindRefrenceId)
        {
            bool result = tpldal.RemoveBind(templateBindType, bindRefrenceId);

            RepositoryDataCache.ClearTemplateBinds();
        }
Пример #21
0
 internal bool RemoveBind(TemplateBindType type, string bindID)
 {
     bool result=dal.RemoveBind(type, bindID);
     //WeakRefCache.RebuiltTemplateBind();
     return result;
 }
Пример #22
0
 public TemplateBind CreateTemplateBind(int id, TemplateBindType type, string templatePath)
 {
     return(new TemplateBind(id, type, templatePath));
 }
Пример #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <param name="type"></param>
 /// <param name="templatePath"></param>
 /// <returns></returns>
 public ITemplateBind CreateTemplateBind(int id, TemplateBindType type, string templatePath)
 {
     return new TemplateBind(id, type, templatePath);
 }
Пример #24
0
 public TemplateBind(int id, TemplateBindType type, string templatePath)
 {
     this.ID       = id;
     this.BindType = type;
     this.TplPath  = templatePath;
 }