protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (Request.QueryString.ToString().Trim().Length == 6)
            {
                QueryAreaCode = Request.QueryString.ToString().Trim();
                QueryAreaName = Dictionary.GetDictionaryName(DictionaryType.A, QueryAreaCode);
            }

            try
            {
                string[] args = Request.CurrentExecutionFilePath.Split('/');

                CurrentCategoryCode = args[args.Length - 1].Split('.')[0];

                CurrentCategory = Category.Get(CurrentCategoryCode);
            }
            catch
            {
                //
            }

            if (CurrentCategory == null)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }
        }
Example #2
0
 private void SaveCategory()
 {
     Response.Clear();
     if (Request.Form["cateId"] != null &&
         Request.Form["parentId"] != null &&
         Request.Form["cateName"] != null &&
         Request.Form["catePrice"] != null &&
         Request.Form["cateRelated"] != null &&
         Request.Form["cateDesc"] != null)
     {
         try
         {
             string cateId = Request.Form["cateId"].Trim();
             string parentId = Request.Form["parentId"].Trim();
             string cateName = Request.Form["cateName"].Trim();
             short catePrice = Convert.ToInt16(Request.Form["catePrice"]);
             string cateRelated = Request.Form["cateRelated"].Trim();
             string cateDesc = Request.Form["cateDesc"].Trim();
             Category cat = new Category(parentId, cateName, cateDesc, cateRelated);
             cat.Price = catePrice;
             Response.Write(cat.Save(cateId));
         }
         catch
         {
             //
         }
     }
     Response.End();
 }
Example #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (Request["id"] != null)
            {
                CurrentCategory = Category.Get(Request["id"].Trim());
            }

            if (CurrentCategory == null)
            {
                CurrentCategory = new Category();
            }

            if (IsPost)
            {
                switch (AjaxAction)
                {
                    case "CategoryPage.save":
                        SaveCategory();
                        break;
                }
            }
        }
Example #4
0
        /// <summary>
        /// ��ȡ�����б��ÿ�а���[Id],Title,[Description]
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static ArrayList ListByIdStringAndKeywords(string ids,string key)
        {
            /*
            CategoryListByIdStringAndKeywords
            @ids varchar(5000),
            @key varchar(50)

            */

            //[Id],Title,[Description]
            ArrayList list = new ArrayList();

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "CategoryListByIdStringAndKeywords",
                    new SqlParameter[] {
                                    Database.MakeInParam("@ids", SqlDbType.VarChar, 5000, ids),
                                    Database.MakeInParam("@key", SqlDbType.VarChar, 50, key)
                                });
                while (reader.Read())
                {
                    Category cat = new Category();
                    cat.id = reader.GetString(0);
                    cat.title = reader.GetString(1);
                    cat.description = reader.GetString(2);
                    list.Add(cat);
                }
                reader.Close();
            }
            catch
            {
                //throw e;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Example #5
0
        /// <summary>
        /// �����б�
        /// </summary>
        /// <param name="parentId"></param>
        /// <returns></returns>
        public static ArrayList List(string parentId)
        {
            /*CategoryList
             @pid varchar(50)='100'*/

            //[Id], Title, Related,Price, Leads, Suppliers, Enable
            ArrayList list = new ArrayList();

            if (parentId==null)
            {
                parentId = "";
            }

            SqlParameter[] prams ={
                Database.MakeInParam("@pid",SqlDbType.VarChar,50,parentId)
            };

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "CategoryList", prams);
                while (reader.Read())
                {
                    Category cat = new Category();
                    cat.id = reader.GetString(0);
                    cat.title = reader.GetString(1);
                    cat.relatedCategories = reader.GetString(2);
                    cat.price = reader.GetInt16(3);
                    cat.leads = reader.GetInt32(4);
                    cat.suppliers = reader.GetInt32(5);
                    cat.enable = reader.GetString(6) == "1";
                    list.Add(cat);
                }
                reader.Close();
            }
            catch(Exception e)
            {
                throw e;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Example #6
0
        /// <summary>
        /// ��ȡ����
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Category Get(string id)
        {
            /*
             CategoryGet
             @id varchar(50)
             */
            //Title, [Description], Related,Price, Leads, Suppliers, Enable
            Category cate = null;

            SqlParameter[] prams ={
                Database.MakeInParam("@id",SqlDbType.VarChar,50,id)
            };

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "CategoryGet", prams);
                if (reader.Read())
                {
                    cate = new Category();
                    cate.id = id;
                    cate.title = reader.GetString(0);
                    cate.description = reader.GetString(1);
                    cate.relatedCategories = reader.GetString(2);
                    cate.price = reader.GetInt16(3);
                    cate.leads = reader.GetInt32(4);
                    cate.suppliers = reader.GetInt32(5);
                    cate.enable = reader.GetString(6) == "1";
                }
                reader.Close();
            }
            catch
            {
                //throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return cate;
        }