Ejemplo n.º 1
0
    //For Updating Attribute
    public int DALUpdateAttribute(AttributeBLL at)
    {
        using (SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[6];
                par[0]           = new SqlParameter("@attributeId", at.attributeId);
                par[1]           = new SqlParameter("@attributeName", at.attributeName);
                par[2]           = new SqlParameter("@attributeValue", at.attributeValue);
                par[3]           = new SqlParameter("@attributeType", at.attributeType);
                par[4]           = new SqlParameter("@categoryId", at.categoryId);
                par[5]           = new SqlParameter("@Status", 100);
                par[5].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "spAttributeUpdate", par);
                status = (int)par[5].Value;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        return(status);
    }
Ejemplo n.º 2
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            AttributeInfo attribute = new AttributeInfo();

            attribute.ID               = RequestHelper.GetQueryString <int>("ID");
            attribute.Name             = this.Name.Text;
            attribute.AttributeClassID = RequestHelper.GetQueryString <int>("AttributeClassID");
            attribute.InputType        = Convert.ToInt32(this.InputType.Text);
            attribute.InputValue       = this.InputValue.Text;
            string message = ShopLanguage.ReadLanguage("AddOK");

            if (attribute.ID == -2147483648)
            {
                base.CheckAdminPower("AddAttribute", PowerCheckType.Single);
                int id = AttributeBLL.AddAttribute(attribute);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Attribute"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateAttribute", PowerCheckType.Single);
                AttributeBLL.UpdateAttribute(attribute);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Attribute"), attribute.ID);
                message = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(message, RequestHelper.RawUrl);
        }
Ejemplo n.º 3
0
        private void GetAttribute()
        {
            AttributeBLL          pcBll  = new AttributeBLL();
            IList <PNK_Attribute> lstAll = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, int.MinValue, string.Empty, 1, true, string.Empty, 1, 9999, out total);
            IList <PNK_Attribute> lst    = lstAll.Where(m => m.ParentId == 0).ToList();

            PopulateTreeView(lstAll, lst, 0, null);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.ClearCache();
            int queryString = RequestHelper.GetQueryString <int>("AttributeClassID");
            int productID   = RequestHelper.GetQueryString <int>("ProductID");

            this.attributeList = AttributeBLL.JoinAttribute(queryString, productID);
        }
Ejemplo n.º 5
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            base.CheckAdminPower("DeleteAttribute", PowerCheckType.Single);
            string intsForm = RequestHelper.GetIntsForm("SelectID");

            if (intsForm != string.Empty)
            {
                AttributeBLL.DeleteAttribute(intsForm);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Attribute"), intsForm);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Ejemplo n.º 6
0
        public static void Init()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["LiteCommerce"].ConnectionString;

            //TODO : Khởi tạo các BLL Khi cần sử dụng
            CatalogBLL.Initialize(connectionString);
            EmployeeBLL.Initialize(connectionString);
            CountryBLL.Initialize(connectionString);
            AttributeBLL.Initialize(connectionString);
            ProductAttributeBLL.Initialize(connectionString);
            UserAccountBLL.Initialize(connectionString);
            OrderBLL.Initialize(connectionString);
        }
        public ActionResult Attribute(string CategoryID, string ProductID, string Type = "")
        {
            /// Danh sach name attribute
            List <DomainModels.Attribute> getAttribute = new List <DomainModels.Attribute>();

            getAttribute = AttributeBLL.getAll(Convert.ToInt32(CategoryID));

            // Lấy danh sách tất cả các Attribute theo ProductID
            List <ProductAttribute> getAll = ProductAttributeBLL.getAll(Convert.ToInt32(ProductID));

            if (Type.Equals("Update"))
            {
                if (getAll.Count == 0)
                {
                    Type = "Add";
                }
                else if (getAll != null)
                {
                    ProductAttributeModel editProductAttributeModel = new ProductAttributeModel()
                    {
                        ProductID             = Convert.ToInt32(ProductID),
                        ListProductAttributes = getAll
                    };
                    ViewBag.Type      = "Update";
                    ViewBag.ProductID = ProductID;
                    return(View(editProductAttributeModel));
                }
            }

            if (Type.Equals("Add"))
            {
                List <DomainModels.ProductAttribute> getNameAttribute = new List <DomainModels.ProductAttribute>();
                foreach (var attribute in getAttribute)
                {
                    getNameAttribute.Add(new DomainModels.ProductAttribute()
                    {
                        AttributeName = attribute.AttributeName
                    });
                }
                ProductAttributeModel addProductAttribute = new ProductAttributeModel()
                {
                    ProductID             = Convert.ToInt32(ProductID),
                    ListProductAttributes = getNameAttribute
                };

                ViewBag.Type      = "Add";
                ViewBag.ProductID = ProductID;
                return(View(addProductAttribute));
            }
            return(View());
        }
Ejemplo n.º 8
0
        protected void HanderAttribute(ProductInfo product)
        {
            if (product.ID > 0)
            {
                AttributeRecordBLL.DeleteAttributeRecordByProductID(product.ID.ToString());
            }
            List <AttributeInfo> list = AttributeBLL.ReadAttributeListByClassID(product.AttributeClassID);

            foreach (AttributeInfo info in list)
            {
                AttributeRecordInfo attributeRecord = new AttributeRecordInfo();
                attributeRecord.AttributeID = info.ID;
                attributeRecord.ProductID   = product.ID;
                attributeRecord.Value       = RequestHelper.GetForm <string>(info.ID.ToString() + "Value");
                AttributeRecordBLL.AddAttributeRecord(attributeRecord);
            }
        }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadAttribute", PowerCheckType.Single);
         this.AttributeClass.DataSource     = AttributeClassBLL.ReadAttributeClassCacheList();
         this.AttributeClass.DataTextField  = "Name";
         this.AttributeClass.DataValueField = "ID";
         this.AttributeClass.DataBind();
         this.InputType.DataSource     = EnumHelper.ReadEnumList <InputType>();
         this.InputType.DataTextField  = "ChineseName";
         this.InputType.DataValueField = "Value";
         this.InputType.DataBind();
         this.InputType.Items[0].Selected = true;
         string queryString = RequestHelper.GetQueryString <string>("Action");
         int    id          = RequestHelper.GetQueryString <int>("ID");
         if ((queryString != string.Empty) && (id > 0))
         {
             if (queryString == "Up")
             {
                 AttributeBLL.ChangeAttributeOrder(ChangeAction.Up, id);
             }
             else
             {
                 AttributeBLL.ChangeAttributeOrder(ChangeAction.Down, id);
             }
         }
         if (id != -2147483648)
         {
             AttributeInfo info = AttributeBLL.ReadAttributeCache(id);
             this.Name.Text       = info.Name;
             this.InputType.Text  = info.InputType.ToString();
             this.InputValue.Text = info.InputValue;
         }
         this.attributeClassIDAspx         = RequestHelper.GetQueryString <int>("AttributeClassID");
         this.AttributeClass.SelectedValue = this.attributeClassIDAspx.ToString();
         base.BindControl(AttributeBLL.ReadAttributeListByClassID(this.attributeClassIDAspx), this.RecordList);
     }
 }
Ejemplo n.º 10
0
    //Gets Selected category
    public DataTable DALGetSelectedAttribute(AttributeBLL at)
    {
        using (SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[1];
                par[0] = new SqlParameter("@attributeId", at.attributeId);

                ds = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, "spAttributeSelectById", par);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        return(ds.Tables[0]);
    }
Ejemplo n.º 11
0
 public DataTable BLLShowAttributeByCategoryId(AttributeBLL ic)
 {
     return dtAttribute = attributeDALObj.DALShowAttributeByCategoryId(ic);
 }
Ejemplo n.º 12
0
 public DataTable BLLGetCategoryWiseAttribute(AttributeBLL ic)
 {
     return dtAttribute = attributeDALObj.DALGetCategoryWiseAttribute(ic);
 }
Ejemplo n.º 13
0
 public DataTable BLLGetSelectedRecord(AttributeBLL at)
 {
     return dtAttribute = attributeDALObj.DALGetSelectedAttribute(at);
 }
Ejemplo n.º 14
0
 public int BLLUpdateCategoryAttribute(AttributeBLL at)
 {
     return status = attributeDALObj.DALUpdateAttribute(at);
 }
Ejemplo n.º 15
0
 public int BLLInsertCategoryAttribute(AttributeBLL at)
 {
     return status = attributeDALObj.DALInsertAttribute(at);
 }