Esempio n. 1
0
        /// <summary>
        /// Performs one "select * from MyTable where [InformedProperties]". MinValues and nulls are skipped from filter.
        /// </summary>
        /// <param name="filter">ProductsInfo</param>
        /// <returns>List of found records.</returns>
        public virtual List <ProductsInfo> GetSome(ProductsInfo filter)
        {
            List <ProductsInfo> AllInfoList = new List <ProductsInfo>();
            string             filterWhere  = string.Empty;
            List <DbParameter> paramList    = null;

            GenerateWhere(filter, out filterWhere, out paramList);
            motor.ClearCommandParameters();
            motor.AddCommandParameters(paramList);
            motor.CommandText = GetSelectCommand() + " " + filterWhere;
            DbDataReader dbReader    = motor.ExecuteReader();
            ClassFiller  classFiller = new ClassFiller(typeof(ProductsInfo), dbReader);

            using (dbReader)
            {
                while (dbReader.Read())
                {
                    ProductsInfo ProductsInfo = new ProductsInfo();
                    ///Warning: performance issues with this automation. See method description for details.
                    classFiller.Fill(ProductsInfo);
                    AllInfoList.Add(ProductsInfo);
                }
            }
            return(AllInfoList);
        }
Esempio n. 2
0
        /// <summary>
        /// Delete registers based on class values informed. MinValues and nulls are skipped.
        /// </summary>
        /// <param name="parProductsInfo">Item to delete</param>
        /// <param name="transaction">Transaction context</param>
        /// <param name="errorMessage">Error message</param>
        public virtual void Delete(ProductsInfo parProductsInfo, DbTransaction transaction, out string errorMessage)
        {
            errorMessage = null;
            try
            {
                string        whereClausule = string.Empty;
                var           pks           = GetPrimaryKey();
                List <string> primaryKeys   = new List <string>();
                foreach (var item in pks)
                {
                    primaryKeys.Add(item.Key);
                }

                List <DbParameter> paramList = ParameterBuilder.GetParametersForDelete(primaryKeys, typeof(ProductsInfo), parProductsInfo, motor.Command, out whereClausule);

                motor.CommandText = GetDeleteCommand() + " " + whereClausule;
                motor.ClearCommandParameters();
                motor.AddCommandParameters(paramList);
                motor.AddTransaction(transaction);
                motor.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
            }
        }
Esempio n. 3
0
        //[OutputCache(CacheProfile = "ActionCacheProfile")]
        public string GetTerTypeList(string TypeMode)
        {
            IList <ProductsInfo> ictlist = null;

            if (CacheHelper.Get("TerTypeList") != null)
            {
                ictlist = (IList <ProductsInfo>)CacheHelper.Get("TerTypeList");
            }
            else
            {
                ProductsInfo pi = new ProductsInfo();
                ictlist = productsInfoBll.GetProductsInfoPage(pi);
                CacheHelper.Insert("TerTypeList", ictlist, 365 * 24 * 60);
                if (TypeMode == "true")
                {
                    ProductsInfo c = new ProductsInfo();
                    c.ProId    = "";
                    c.ProModel = "--选择终端型号--";
                    c.ProName  = "--选择终端类型--";
                    ictlist.Insert(0, c);
                }
            }

            string json = ConvertToJson(ictlist);

            return(json);
        }
Esempio n. 4
0
        /// <summary>
        /// Get one register using only ID as key.
        /// </summary>
        /// <returns></returns>
        public virtual ProductsInfo GetValueByID(int ProductID)
        {
            //ToDo: set multiple PK filter
            motor.ClearCommandParameters();
            motor.CommandText = GetSelectCommand() + GetWherePrimaryKey();
            List <DbParameter> paramList = new List <DbParameter>();


            DbParameter paramProductID = motor.Command.CreateParameter();

            paramProductID.ParameterName = "@param_ProductID";
            paramProductID.Value         = ProductID;
            paramList.Add(paramProductID);


            motor.AddCommandParameters(paramList);
            ProductsInfo InfoValue = new ProductsInfo();

            DbDataReader dbReader    = motor.ExecuteReader();
            ClassFiller  classFiller = new ClassFiller(typeof(ProductsInfo), dbReader);

            using (dbReader)
            {
                if (dbReader.Read())
                {
                    InfoValue = new ProductsInfo();
                    classFiller.Fill(InfoValue);
                }
                else
                {
                    return(null);
                }
            }
            return(InfoValue);
        }
        public string AddProductsInfo(string passCode, string pStandard, string pUnits, string pMaxUnits, int pToBoxNo, string pBrand)
        {
            string _re = "";

            if (checkPassCode(passCode))
            {
                ProductsInfo pi = new ProductsInfo();

                pi.pStandard      = pStandard;
                pi.pUnits         = pUnits;
                pi.pMaxUnits      = pMaxUnits;
                pi.pToBoxNo       = pToBoxNo;
                pi.pState         = 0;
                pi.pBrand         = pBrand;
                pi.pPrice         = pPrice;
                pi.pSellingPrice  = pSellingPrice;
                pi.pDoDayQuantity = pDoDayQuantity;
                pi.ProductClassID = ProductClassID;
                pi.pProducer      = pProducer;
                pi.pExpireDay     = pExpireDay;
                pi.pAddress       = pAddress;

                pi.pCode       = Utils.GetRanDomCode();
                pi.pBarcode    = pBarcode;
                pi.pName       = pName;
                pi.pAppendTime = DateTime.Now;

                int _ProductsID = tbProductsInfo.AddProductsInfo(pi);
            }
            return(_re);
        }
Esempio n. 6
0
        /// <summary>
        /// Insert one register in database.
        /// </summary>
        /// <param name="parProductsInfo">Item to delete</param>
        /// <param name="transaction">Transaction context</param>
        /// <param name="errorMessage">Error message</param>
        public virtual void InsertOne(ProductsInfo parProductsInfo, DbTransaction transaction, out string errorMessage)
        {
            errorMessage = null;
            try
            {
                motor.CommandText = GetInsertCommand();
                ///Warning: performance issues with this automation. See method description for details.
                List <DbParameter> paramList = ParameterBuilder.GetParametersForInsert(typeof(ProductsInfo), parProductsInfo, motor.Command);
                motor.ClearCommandParameters();
                motor.AddCommandParameters(paramList);
                motor.AddTransaction(transaction);


                if (GetIdentity == true)
                {
                    parProductsInfo.ProductID = motor.ExecuteScalar();
                }
                else
                {
                    motor.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
            }
        }
Esempio n. 7
0
        public ProductsInfo GetProductInfo(int id)
        {
            ProductsInfo pr    = null;
            var          param = new[] { new SqlParameter("@pk_ID", id) };
            var          r     = DataHelper.ExecuteReader(Config.ConnectionString, "usp_Product_GetDetail", param);

            while (r.Read())
            {
                pr = new ProductsInfo
                {
                    pk_ID         = UntilityFunction.IntegerForNull((r["pk_ID"])),
                    s_Name        = UntilityFunction.StringForNull(r["s_Name"]),
                    s_Description = UntilityFunction.StringForNull(r["s_Description"]),
                    f_Price       = UntilityFunction.DoubleForNull(r["f_Price"]),
                    //fk_ProductID = UntilityFunction.IntegerForNull(r["fk_ProductID"]),
                    //s_ProductName = UntilityFunction.StringForNull(r["s_ProductName"]),
                    s_Image      = UntilityFunction.StringForNull(r["s_Image"]),
                    s_Content    = UntilityFunction.StringForNull(r["s_Content"]),
                    d_CreateDate = Convert.ToDateTime(r["d_CreateDate"].ToString()),
                    SortField    = UntilityFunction.IntegerForNull(r["SortField"]),
                    //sPath = UntilityFunction.StringForNull(r["path"]),
                    Active = (UntilityFunction.StringForNull(r["Active"]) == "Y")
                };
            }
            r.Close(); r.Dispose();
            return(pr);
        }
Esempio n. 8
0
        /// <summary>
        /// Delete registers based on ID informed. Other values are skipped.
        /// </summary>
        /// <param name="parProductsInfo">Item to delete</param>
        /// <param name="errorMessage">Error message</param>
        public virtual void DeleteByID(ProductsInfo parProductsInfo, out string errorMessage)
        {
            ProductsInfo newParam = new ProductsInfo();

            newParam.ProductID = parProductsInfo.ProductID;
            this.Delete(newParam, out errorMessage);
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                ProductsID = Utils.StrToInt(HTTPRequest.GetString("pid"), 0);

                pi = tbProductsInfo.GetProductsInfoModel(ProductsID);

                ProductFieldValueList = tbProductsFieldValueInfo.GetProductsFieldValueList(" ProductsID = " + ProductsID).Tables[0];

                ProductFieldList = tbProductFieldInfo.GetProductFieldList(" ProductClassID in (0," + pi.ProductClassID + ") and pfState=0 order by pfOrder desc");

                ProductFieldList.Columns.Add("FieldValue", typeof(string));

                for (int i = 0; i < ProductFieldList.Rows.Count; i++)
                {
                    for (int j = 0; j < ProductFieldValueList.Rows.Count; j++)
                    {
                        if ((int)ProductFieldList.Rows[i]["ProductFieldID"] == (int)ProductFieldValueList.Rows[j]["ProductFieldID"])
                        {
                            ProductFieldList.Rows [i] ["FieldValue"] = ProductFieldValueList.Rows [j] ["pfvData"].ToString().Replace("[br]", "<br>").Replace("[b]", "<b>").Replace("[/b]", "</b>");
                        }
                    }
                }
                ProductFieldList.AcceptChanges();
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 10
0
 /// <summary>
 /// Delete registers based on class values informed. MinValues and nulls are skipped.
 /// Must have "MultipleActiveResultSets=True" on connection string.
 /// </summary>
 /// <param name="parProductsInfo">Item to delete</param>
 /// <param name="transaction">Transaction context</param>
 /// <param name="errorMessage">Error message</param>
 public virtual void Delete(ProductsInfo parProductsInfo, DbTransaction transaction, out string errorMessage)
 {
     errorMessage = string.Empty;
     ProductsDAO.Delete(parProductsInfo, transaction, out errorMessage);
     //By default, the caller of this method will do the commit.
     //motor.Commit();
     //motor.CloseConnection();
 }
Esempio n. 11
0
        public void DeleteData(ModelNotifiedForProducts modelNotifiedForProducts, out string error)
        {
            ProductsBsn  bsn    = new ProductsBsn(wpfConfig);
            ProductsInfo dbItem = new ProductsInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForProducts), modelNotifiedForProducts, typeof(ProductsInfo), dbItem);
            bsn.DeleteByID(dbItem, out error);
        }
Esempio n. 12
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddProductsInfo(ProductsInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbProductsInfo(");
            strSql.Append("pCode,pBarcode,pName,pEnName,pBrand,pStandard,pUnits,pToBoxNo,pState,pAppendTime,pPrice,pDoDayQuantity,ProductClassID,pMaxUnits,pProducer,pExpireDay,pAddress)");
            strSql.Append(" values (");
            strSql.Append("@pCode,@pBarcode,@pName,@pEnName,@pBrand,@pStandard,@pUnits,@pToBoxNo,@pState,@pAppendTime,@pPrice,@pDoDayQuantity,@ProductClassID,@pMaxUnits,@pProducer,@pExpireDay,@pAddress)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pCode",          SqlDbType.VarChar,    50),
                new SqlParameter("@pBarcode",       SqlDbType.VarChar,    50),
                new SqlParameter("@pName",          SqlDbType.VarChar,   128),
                new SqlParameter("@pBrand",         SqlDbType.VarChar,   128),
                new SqlParameter("@pStandard",      SqlDbType.VarChar,    50),
                new SqlParameter("@pUnits",         SqlDbType.VarChar,    50),
                new SqlParameter("@pToBoxNo",       SqlDbType.Int,         4),
                new SqlParameter("@pState",         SqlDbType.Int,         4),
                new SqlParameter("@pAppendTime",    SqlDbType.DateTime),
                new SqlParameter("@pPrice",         SqlDbType.Money,       8),
                new SqlParameter("@pDoDayQuantity", SqlDbType.Decimal),
                new SqlParameter("@ProductClassID", SqlDbType.Int,         4),
                new SqlParameter("@pMaxUnits",      SqlDbType.VarChar,    50),
                new SqlParameter("@pProducer",      SqlDbType.VarChar,   512),
                new SqlParameter("@pExpireDay",     SqlDbType.VarChar,    50),
                new SqlParameter("@pAddress",       SqlDbType.VarChar,   512),
                new SqlParameter("@pEnName",        SqlDbType.VarChar,   128),
            };
            parameters[0].Value  = model.pCode;
            parameters[1].Value  = model.pBarcode;
            parameters[2].Value  = model.pName;
            parameters[3].Value  = model.pBrand;
            parameters[4].Value  = model.pStandard;
            parameters[5].Value  = model.pUnits;
            parameters[6].Value  = model.pToBoxNo;
            parameters[7].Value  = model.pState;
            parameters[8].Value  = model.pAppendTime;
            parameters[9].Value  = model.pPrice;
            parameters[10].Value = model.pDoDayQuantity;
            parameters[11].Value = model.ProductClassID;
            parameters[12].Value = model.pMaxUnits;
            parameters[13].Value = model.pProducer;
            parameters[14].Value = model.pExpireDay;
            parameters[15].Value = model.pAddress;
            parameters[16].Value = model.pEnName;

            object obj = DbHelper.ExecuteScalar(CommandType.Text, strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Performs one "update" database command.
        /// Will commit the transaction and close the connection. Use for independent delete.
        /// </summary>
        /// <param name="ProductsInfo">Object to update.</param>
        /// <param name="errorMessage">Error message if exception is throwed</param>
        public virtual void UpdateOne(ProductsInfo parProductsInfo, out string errorMessage)
        {
            errorMessage = string.Empty;
            DbTransaction transaction = motor.BeginTransaction();

            this.UpdateOne(parProductsInfo, transaction, out errorMessage);
            motor.Commit();
            motor.CloseConnection();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.userid > 0)
     {
         objstr  = HTTPRequest.GetString("obj");
         pid     = HTTPRequest.GetInt("pid", 0);
         num_iid = Utils.ChkSQL(HTTPRequest.GetString("num_iid"));
         if (pid > 0 && num_iid.Trim() != "")
         {
             mProducts = tbProductsInfo.GetProductsInfoModel(pid);
             mGoods    = M_Utils.GetM_GoodsInfoModelByNum_iid(M_Config.m_ConfigInfoID, long.Parse(num_iid));
             if (mGoods != null)
             {
                 if (!ispost)
                 {
                     dList = M_Utils.GetM_GoodsStockList(M_Config.m_ConfigInfoID, mGoods.m_GoodsID);
                 }
                 else
                 {
                     int m_count   = HTTPRequest.GetInt("m_count", 0);
                     int StorageID = 0;
                     int num       = 0;
                     int sum_num   = 0;
                     try
                     {
                         if (m_count > 0)
                         {
                             for (int i = 0; i < m_count; i++)
                             {
                                 StorageID = HTTPRequest.GetInt("m_StorageID_" + (i + 1), 0);
                                 num       = HTTPRequest.GetInt("num_" + (i + 1), 0);
                                 sum_num  += num;
                                 M_Utils.UpdateM_GoodsStockNum(M_Config.m_ConfigInfoID, pid, num, StorageID);
                             }
                             //更新商品总数量字段
                             M_Utils.UpdateM_GoodsNum(M_Config.m_ConfigInfoID, long.Parse(num_iid), sum_num);
                         }
                         AddMsgLine("更新成功!");
                         AddScript("window.setTimeout('window.parent.ReCall({\"sobj\":\"" + objstr + "\",\"num\":\"" + sum_num + "\"});window.parent.HidBox();',1000);");
                     }catch (Exception ex) {
                         AddErrLine("系统错误:" + ex.Message);
                     }
                 }
             }
             else
             {
                 AddErrLine("参数错误!");
             }
         }
     }
     else
     {
         AddErrLine("请先登录!");
         SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
         SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
     }
 }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-3-3"))
                {
                    Act        = HTTPRequest.GetString("Act");
                    ProductsID = HTTPRequest.GetInt("pid", 0);
                    if (Act == "List")
                    {
                        pi    = tbProductsInfo.GetProductsInfoModel(ProductsID);
                        dList = tbProductsInfo.GetProductsPriceClassPriceList(ProductsID);
                    }
                    if (Act == "Save")
                    {
                        try
                        {
                            pPrice = Utils.ChkSQL(HTTPRequest.GetString("pPrice"));
                            //pIsEdit = Utils.ChkSQL(HTTPRequest.GetString("pIsEdit"));

                            string[] pPriceArray = Utils.SplitString(pPrice, ";");
                            //string[] pIsEditArray = Utils.SplitString(pIsEdit, ";");
                            foreach (string pArray in pPriceArray)
                            {
                                string[] pp = Utils.SplitString(pArray, ",");
                                if (pp.Length > 0)
                                {
                                    if (pp[0].ToString().Trim() != "" && pp[1].ToString().Trim() != "" && pp[2].ToString().Trim() != "")
                                    {
                                        tbPriceClassDefaultPriceInfo.SavePriceClassDefaultPrice(Convert.ToInt32(pp[0].ToString().Trim()), ProductsID, Convert.ToDecimal(pp[1].ToString().Trim()), Convert.ToInt32(pp[2].ToString().Trim()));
                                    }
                                }
                                pp = null;
                            }
                            AddMsgLine("保存成功!");
                            AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                        }
                        catch (Exception ex)
                        {
                            AddErrLine("保存失败!<br/>" + ex);
                            AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 16
0
        public void AddData(ModelNotifiedForProducts modelNotifiedForProducts, out string error)
        {
            ProductsBsn  bsn    = new ProductsBsn(wpfConfig);
            ProductsInfo dbItem = new ProductsInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForProducts), modelNotifiedForProducts, typeof(ProductsInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForProducts.NewItem = false;
            Cloner.CopyAllTo(typeof(ProductsInfo), dbItem, typeof(ModelNotifiedForProducts), modelNotifiedForProducts);
        }
Esempio n. 17
0
        /// <summary>
        /// Delete registers based on class ID informed in transactional context. Other values are skipped.
        /// Must have "MultipleActiveResultSets=True" on connection string.
        /// </summary>
        /// <param name="parProductsInfo">Item to delete</param>
        /// <param name="transaction">Transaction context</param>
        /// <param name="errorMessage">Error message</param>
        public virtual void DeleteByID(ProductsInfo parProductsInfo, DbTransaction transaction, out string errorMessage)
        {
            ProductsInfo newParam = new ProductsInfo();

            newParam.ProductID = parProductsInfo.ProductID;
            this.Delete(newParam, transaction, out errorMessage);
            //By default, the caller of this method will do the commit.
            //motor.Commit();
            //motor.CloseConnection();
        }
Esempio n. 18
0
        public ModelNotifiedForProducts GetProductsByID(int ProductID, out string error)
        {
            error = null;
            ProductsBsn              bsn    = new ProductsBsn(wpfConfig);
            ProductsInfo             dbItem = bsn.GetValueByID(ProductID);
            ModelNotifiedForProducts item   = new ModelNotifiedForProducts();

            Cloner.CopyAllTo(typeof(ProductsInfo), dbItem, typeof(ModelNotifiedForProducts), item);
            return(item);
        }
Esempio n. 19
0
        protected void AddToCart(string productId, string quantity)
        {
            ProductsInfo info  = ProductsManager.Select(int.Parse(productId));
            bool         check = false;

            if (Session["Cart"] != null)
            {
                DataTable dx = (DataTable)Session["Cart"];
                foreach (DataRow dtRow in dx.Rows)
                {
                    if (dtRow["ProductId"].ToString().Equals(productId))
                    {
                        dtRow["Quantity"] = int.Parse(dtRow["Quantity"].ToString()) + int.Parse(quantity);
                        check             = true;
                    }
                }
                if (!check)
                {
                    DataRow dr = dx.NewRow();
                    dr["ProductId"] = info.ProductID;
                    dr["Name"]      = info.ProductName;
                    dr["ImgPath"]   = info.ProductImage;
                    dr["Quantity"]  = 1;
                    if (Decimal.Parse(info.Discount.ToString().Trim()) == 0)
                    {
                        dr["Price"] = info.ProductPrice;
                    }
                    else
                    {
                        dr["Price"] = info.Discount;
                    }
                    dx.Rows.Add(dr);
                }
                Session["Cart"] = dx;
            }
            else
            {
                Session["Cart"] = CreateTable();
                DataRow dr = DTShoppingCart.NewRow();
                dr["ProductId"] = info.ProductID;
                dr["Name"]      = info.ProductName;
                dr["ImgPath"]   = info.ProductImage;
                dr["Quantity"]  = 1;
                if (Decimal.Parse(info.Discount.ToString().Trim()) == 0)
                {
                    dr["Price"] = info.ProductPrice;
                }
                else
                {
                    dr["Price"] = info.Discount;
                }
                DTShoppingCart.Rows.Add(dr);
                Session["Cart"] = DTShoppingCart;
            }
        }
Esempio n. 20
0
        public async Task <ActionResult> ProductDetails(string id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            id = id.Replace("$25", "/");
            id = id.Replace("$24", "+");
            int          refID = Convert.ToInt32(Cryptoclass.DecryptStringAES(id, s));
            ProductsInfo p     = await db.ProductTb.FindAsync(refID);

            return(View(p));
        }
Esempio n. 21
0
        /// <summary>
        /// Retrieves the data using only the primary key ID. Ex.: "Select * from MyTable where id=1"
        /// </summary>
        /// <returns>The class filled if found.</returns>
        public virtual ProductsInfo GetValueByID(int ProductID)
        {
            motor.OpenConnection();
            ProductsInfo value = ProductsDAO.GetValueByID(ProductID);

            if (this.closeConnectionWhenFinish)
            {
                motor.CloseConnection();
            }
            return(value);
        }
Esempio n. 22
0
        /// <summary>
        /// Perform one "select" command to database. Filter the data using "filter" class.
        /// </summary>
        /// <param name="filter">Class to use as filter</param>
        /// <returns>List with filtered data</returns>
        public virtual List <ProductsInfo> GetSome(ProductsInfo filter)
        {
            motor.OpenConnection();
            List <ProductsInfo> list = ProductsDAO.GetSome(filter);

            if (this.closeConnectionWhenFinish)
            {
                motor.CloseConnection();
            }
            return(list);
        }
Esempio n. 23
0
 protected string GetProductName(int id)
 {
     try
     {
         ProductsInfo name = ProductsManager.Select(id);
         return(name.ProductName);
     }
     catch
     {
     }
     return("N/A");
 }
Esempio n. 24
0
        public string getDetailProduct(int id)
        {
            ProductsInfo info = ProductsManager.Select(id);

            try
            {
                return(info.Description.ToString());
            }
            catch (Exception)
            {
                return("");
            }
        }
Esempio n. 25
0
        public ActionResult Index(int id)
        {
            ProductsInfo model = new ProductsInfo();

            IProductCategoriesRepository productCategoryRepository = DependencyResolver.Current.GetService <IProductCategoriesRepository>();

            ProductCategory productCategory = productCategoryRepository.GetById(id);

            model.CategoryName        = productCategory.Name;
            model.CategoryDescription = productCategory.Description;
            model.Products            = productCategory.Products.ToList();

            return(View(model));
        }
Esempio n. 26
0
        public static string BuildContentTopDetail(ProductsInfo oItem)
        {
            var sb = new StringBuilder();

            if (oItem != null)
            {
                sb.AppendFormat("<div id=\"title-product\">{0}</div>", oItem.s_Name);
                sb.Append("<div style=\"clear: both\">");
                sb.AppendFormat("<div id=\"image-product\"><img width=\"160\" src=\"{0}\"/></div>", UntilityFunction.GetPathImgProduct(oItem.s_Image));
                sb.AppendFormat("<div id=\"description-product\">{0}</div>", oItem.s_Content);
                sb.Append("</div>");
            }
            return(sb.ToString());
        }
Esempio n. 27
0
 private void Load(ProductsInfo productsInfo)
 {
     Attributes             = productsInfo.Attributes.Select((a) => { return(new Tuple <int, Models.Attribute>(a.Id, a)); }).ToList();
     AttributeValues        = productsInfo.AttributeValues.Select((av) => { return(new Tuple <int, AttributeValue>(av.Id, av)); }).ToList();
     Categories             = productsInfo.Categories.Select((c) => { return(new Tuple <int, Category>(c.Id, c)); }).ToList();
     CategoryCategories     = productsInfo.CategoryCategories.Select((cc) => { return(new Tuple <int, CategoryCategory>(cc.Id, cc)); }).ToList();
     Products               = productsInfo.Products.Select((p) => { return(new Tuple <int, Product>(p.Id, p)); }).ToList();
     ProductAds             = productsInfo.ProductAds.Select((pa) => { return(new Tuple <int, ProductAd>(pa.Id, pa)); }).ToList();
     ProductAttributeValues = productsInfo.ProductAttributeValues.Select((pav) => { return(new Tuple <int, ProductAttributeValue>(pav.Id, pav)); }).ToList();
     ProductCategories      = productsInfo.ProductCategories.Select((pc) => { return(new Tuple <int, ProductCategory>(pc.Id, pc)); }).ToList();
     ProductDiscounts       = productsInfo.ProductDiscounts.Select((pd) => { return(new Tuple <int, ProductDiscount>(pd.Id, pd)); }).ToList();
     ProductImages          = productsInfo.ProductImages.Select((pi) => { return(new Tuple <int, ProductImage>(pi.Id, pi)); }).ToList();
     ProductProperties      = productsInfo.ProductProperties.Select((pp) => { return(new Tuple <int, ProductProperty>(pp.Id, pp)); }).ToList();
 }
Esempio n. 28
0
 private static void ProductsInfoToSheets(this ExcelPackage package, ProductsInfo data)
 {
     package.AddToSheets("Attributes", data.Attributes);
     package.AddToSheets("AttributeValues", data.AttributeValues);
     package.AddToSheets("Categories", data.Categories);
     package.AddToSheets("CategoryCategories", data.CategoryCategories);
     package.AddToSheets("Products", data.Products);
     package.AddToSheets("ProductAds", data.ProductAds);
     package.AddToSheets("ProductAttributeValues", data.ProductAttributeValues);
     package.AddToSheets("ProductCategories", data.ProductCategories);
     package.AddToSheets("ProductDiscounts", data.ProductDiscounts);
     package.AddToSheets("ProductImages", data.ProductImages);
     package.AddToSheets("ProductProperties", data.ProductProperties);
 }
Esempio n. 29
0
        public int AddProductsInfo(
            string passCode,
            string pStandard,
            string pUnits,
            string pMaxUnits,
            int pToBoxNo,
            string pBrand,
            decimal pPrice,
            decimal pSellingPrice,
            int pDoDayQuantity,
            int ProductClassID,
            string pProducer,
            string pExpireDay,
            string pAddress,
            string pBarcode,
            string pName,
            string pCode)
        {
            int _re = 0;

            if (checkPassCode(passCode))
            {
                ProductsInfo pi = new ProductsInfo();

                pi.pStandard      = pStandard;
                pi.pUnits         = pUnits;
                pi.pMaxUnits      = pMaxUnits;
                pi.pToBoxNo       = pToBoxNo;
                pi.pState         = 0;
                pi.pBrand         = pBrand;
                pi.pPrice         = pPrice;
                pi.pSellingPrice  = pSellingPrice;
                pi.pDoDayQuantity = pDoDayQuantity;
                pi.ProductClassID = ProductClassID;
                pi.pProducer      = pProducer;
                pi.pExpireDay     = pExpireDay;
                pi.pAddress       = pAddress;

                pi.pCode       = pCode;
                pi.pBarcode    = pBarcode;
                pi.pName       = pName;
                pi.pAppendTime = DateTime.Now;

                int _ProductsID = tbProductsInfo.AddProductsInfo(pi);

                _re = _ProductsID;
            }
            return(_re);
        }
Esempio n. 30
0
 private static string GetPathImage(ProductsInfo o)
 {
     if (o.s_Image.Trim().Length > 0)
     {
         #if !DEBUG
         return(Config.PathProductShow + "/" + o.s_Image);
         #else
         return(Config.PathProductShow + "/" + o.s_Image);
         #endif
     }
     else
     {
         return("");
     }
 }