Пример #1
0
    protected string GetCatName(string catId)
    {
        CategoryDic categoryDic = new CategoryDic();


        if (categoryDic.Dictionary.ContainsKey(catId))
        {
            return(categoryDic.Dictionary[catId]);
        }
        return(catId);
    }
Пример #2
0
 public void AddFriend(QQFriend friend)
 {
     if (CategoryDic.ContainsKey(friend.CategoryIndex))
     {
         CategoryDic[friend.CategoryIndex].AddFriend(friend);
     }
     else
     {
         AddCategory(new Category()
         {
             Index = friend.CategoryIndex
         });
         AddFriend(friend);
     }
     FriendDic[friend.Uin] = friend;
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CategoryDic categoryDic = new CategoryDic();
         foreach (var key in categoryDic.Dictionary.Keys)
         {
             ddlCatId.Items.Add(new ListItem(categoryDic.Dictionary[key], key));
         }
         HyperLink2.NavigateUrl = listpage;
         if (Request.QueryString["Op"].Equals("Edit"))
         {
             LoadData();
         }
     }
 }
 public bool InsertCategory(CategoryDic model)
 {
     try
     {
         return(handler.InsertCategory(model));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new CategoryDicException(1, "InsertCategory", ex);
         Logger.Log(Level.Error, "InsertCategory", exception);
         throw;
     }
 }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            CategoryDic categoryDic = new CategoryDic();
            foreach (var key in categoryDic.Dictionary.Keys)
            {
                ddlCatId.Items.Add(new ListItem(categoryDic.Dictionary[key], key));
            }
            HyperLink2.NavigateUrl = listpage;
            if (Request.QueryString["Op"].Equals("Edit"))
            {
                LoadData();
            }

        }
    }
Пример #6
0
        public static bool InsertCategory(SqlConnection conn, CategoryDic model)
        {
            string sqlCategory = @"  INSERT INTO Gungnir.dbo.Category
                                                ( 
                                                  [ParentId] ,
                                                  [Name] ,
                                                  [Value] ,
                                                  [Type]
                                                )
                                      VALUES    ( 
                                                  @ParentId ,
                                                  @Name ,
                                                  @Value,
                                                  @Type
                                                );SELECT  @@Identity";

            string sqlNewApp = @" INSERT INTO Gungnir.dbo.tal_newappsetdata
                                             ( apptype ,
                                               modelfloor                                 
                                             )
                                     VALUES  ( @apptype ,
                                               @modelfloor                        
                                             )";


            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@ParentId", model.ParentId),
                new SqlParameter("@Name", model.Name ?? string.Empty),
                new SqlParameter("@Value", model.Value ?? string.Empty),
                new SqlParameter("@Type", model.Type ?? string.Empty)
            };


            SqlTransaction tran;

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            tran = conn.BeginTransaction();

            try
            {
                int apptype = Convert.ToInt32(SqlHelper.ExecuteScalar(tran, CommandType.Text, sqlCategory, sqlParams));

                var sqlParamsApp = new SqlParameter[]
                {
                    new SqlParameter("@apptype", apptype),
                    new SqlParameter("@modelfloor", 1)
                };

                //添加大类后,默认添加1楼,两个模块!
                SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sqlNewApp, sqlParamsApp);
                SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sqlNewApp, sqlParamsApp);
                tran.Commit();
                return(true);
            }
            catch
            {
                tran.Rollback();
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                return(false);

                throw;
            }
            finally
            {
                tran.Dispose();
            }
        }
Пример #7
0
    protected string GetCatName(string catId)
    {
        CategoryDic categoryDic = new CategoryDic();

        if (categoryDic.Dictionary.ContainsKey(catId))
        {
            return categoryDic.Dictionary[catId];
        }
        return catId;
    }
Пример #8
0
 public bool InsertCategory(CategoryDic model)
 {
     return(dbManager.Execute(conn => DALCategory.InsertCategory(conn, model)));
 }
Пример #9
0
 public ActionResult AddCategoryModel(CategoryDic model)
 {
     model.Type     = "app";
     model.ParentId = 0;
     return(Json(CategoryDicManager.InsertCategory(model)));
 }