Esempio n. 1
0
        /// <summary>
        /// 获取当前促销单已经绑定的促销商品组
        /// </summary>
        /// <param name="promotionId"></param>
        /// <returns></returns>
        public static string GetBindedGroup(string promotionId)
        {
            DataTable data = new SqlDBHelper().ExecuteQuery(String.Format(GetBindedGroupSqlCmdTemplate, promotionId));

            if (data.Rows.Count > 0)
            {
                return(data.Rows[0]["GroupName"].ToString());
            }
            else
            {
                return("当前促销未绑定商品");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取所有的有效的促销组的sortedlist集合
        /// </summary>
        /// <returns></returns>
        public static SortedList GetPromotionGroups()
        {
            SortedList list = new SortedList();
            DataTable  data = new SqlDBHelper().ExecuteQuery(GetAllGroupItemsSqlCmdTemplate);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                int    sysNo    = int.Parse(data.Rows[i]["sysNo"].ToString());
                string groupNme = data.Rows[i]["GroupName"].ToString().Trim();
                list.Add(sysNo, groupNme);
            }
            return(list);
        }
Esempio n. 3
0
        /// <summary>
        /// 在插入时 判断同一个group是否有同样的商品
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="productId"></param>
        /// <returns></returns>
        public static bool IsProductExistedForGroup(string groupId, string productId)
        {
            string    sqlCmd = String.Format(CheckProductExistedForGroupSqlCmdTemplate, groupId, productId);
            DataTable data   = new SqlDBHelper().ExecuteQuery(sqlCmd);

            if (data.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取单条图片记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ProductImgRecord GetSingleImgRecord(string id)
        {
            DataTable        data   = new SqlDBHelper().ExecuteQuery(String.Format(GetSingleImgRecordSqlCmdTemplate, id));
            ProductImgRecord record = new ProductImgRecord()
            {
                ProductSysNo = data.Rows[0]["SysNo"].ToString(),
                Id           = data.Rows[0]["id"].ToString(),
                ProductName  = data.Rows[0]["ProductName"].ToString().Trim(),
                LargeImg     = data.Rows[0]["product_limg"].ToString().Trim(),
                SmallImg     = data.Rows[0]["product_simg"].ToString().Trim(),
                OrderNum     = int.Parse(data.Rows[0]["OrderNum"].ToString().Trim()),
                Status       = int.Parse(data.Rows[0]["Status"].ToString().Trim()),
            };

            return(record);
        }
Esempio n. 5
0
        /// <summary>
        /// 更新促销单的商品组绑定
        /// </summary>
        /// <param name="promotionid"></param>
        /// <param name="newgroupId"></param>
        /// <returns></returns>
        public static bool UpdatePromotionGroupBind(string promotionid, string newgroupId, bool isPromotionBinded)
        {
            bool result;

            try
            {
                string sqlCmd1 = String.Format(UpdateGroupBindSqlCmdTemplate[0], promotionid);
                string sqlCmd2 = String.Format(UpdateGroupBindSqlCmdTemplate[1], promotionid, newgroupId);
                if (isPromotionBinded)
                {
                    string[] sqlCmds = new string[2]
                    {
                        sqlCmd1, sqlCmd2,
                    };
                    SqlDBHelper helper = new SqlDBHelper();
                    if (helper.ExecuteTransaction(sqlCmds))
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    string[] sqlCmds = new string[1]
                    {
                        sqlCmd2,
                    };
                    SqlDBHelper helper = new SqlDBHelper();
                    if (helper.ExecuteTransaction(sqlCmds))
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Esempio n. 6
0
 /// <summary>
 /// 获得通知栏文章列表
 /// </summary>
 /// <param name="topNum"></param>
 /// <returns></returns>
 public static Dictionary<string, string> GetWebBulletinList(string topNum)
 {
     string sqlCmd = String.Format(GetWebBulletinListSqlCmdTemplate, topNum);
     DataTable data = new SqlDBHelper().ExecuteQuery(sqlCmd);
     int count = data.Rows.Count;
     if (count > 0)
     {
         Dictionary<string, string> list = new Dictionary<string, string>();
         for (int i = 0; i < count; i++)
         {
             string sysNo = data.Rows[i]["SysNo"].ToString().Trim();
             string title = data.Rows[i]["Title"].ToString().Trim();
             list.Add(sysNo, title);
         }
         return list;
     }
     else
     {
         return null;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 获得通知栏文章列表
        /// </summary>
        /// <param name="topNum"></param>
        /// <returns></returns>
        public static Dictionary <string, string> GetWebBulletinList(string topNum)
        {
            string    sqlCmd = String.Format(GetWebBulletinListSqlCmdTemplate, topNum);
            DataTable data   = new SqlDBHelper().ExecuteQuery(sqlCmd);
            int       count  = data.Rows.Count;

            if (count > 0)
            {
                Dictionary <string, string> list = new Dictionary <string, string>();
                for (int i = 0; i < count; i++)
                {
                    string sysNo = data.Rows[i]["SysNo"].ToString().Trim();
                    string title = data.Rows[i]["Title"].ToString().Trim();
                    list.Add(sysNo, title);
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 获取促销商品组
        /// </summary>
        /// <param name="name"></param>
        /// <param name="orderNum"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static DataTable GetPromotionGroup(string name, string orderNum, int status)
        {
            string sqlCmd    = String.Empty;
            string condition = "WHERE";

            if (name.IsSafeString())
            {
                condition += String.Concat(" GroupName LIKE '%", name, "%'");
            }
            if (orderNum.IsSafeString())
            {
                condition += GroupBuyUtility.CombineMutlQueryCondtion(condition, String.Concat(" OrderNum", orderNum));
            }
            if (status != -999999)
            {
                condition += GroupBuyUtility.CombineMutlQueryCondtion(condition, String.Concat(" Status=", status));
            }
            sqlCmd = (condition == "WHERE") ? String.Format(GetPromotionGroupSqlCmdTemplate, String.Empty) : String.Format(GetPromotionGroupSqlCmdTemplate, condition);
            SqlDBHelper dbHelper = new SqlDBHelper();
            DataTable   data     = dbHelper.ExecuteQuery(sqlCmd);

            return(data);
        }
Esempio n. 9
0
 /// <summary>
 /// 更新促销单的商品组绑定
 /// </summary>
 /// <param name="promotionid"></param>
 /// <param name="newgroupId"></param>
 /// <returns></returns>
 public static bool UpdatePromotionGroupBind(string promotionid, string newgroupId, bool isPromotionBinded)
 {
     bool result;
     try
     {
         string sqlCmd1 = String.Format(UpdateGroupBindSqlCmdTemplate[0], promotionid);
         string sqlCmd2 = String.Format(UpdateGroupBindSqlCmdTemplate[1], promotionid, newgroupId);
         if (isPromotionBinded)
         {
             string[] sqlCmds = new string[2]
             {
                 sqlCmd1,sqlCmd2,
             };
             SqlDBHelper helper = new SqlDBHelper();
             if (helper.ExecuteTransaction(sqlCmds))
             {
                 result = true;
             }
             else
             {
                 result = false;
             }
         }
         else
         {
             string[] sqlCmds = new string[1]
             {
                 sqlCmd2,
             };
             SqlDBHelper helper = new SqlDBHelper();
             if (helper.ExecuteTransaction(sqlCmds))
             {
                 result = true;
             }
             else
             {
                 result = false;
             }
         }
     }
     catch
     {
         result = false;
     }
     return result;
 }
Esempio n. 10
0
 /// <summary>
 /// 在插入时 判断同一个group是否有同样的商品
 /// </summary>
 /// <param name="groupId"></param>
 /// <param name="productId"></param>
 /// <returns></returns>
 public static bool IsProductExistedForGroup(string groupId, string productId)
 {
     string sqlCmd = String.Format(CheckProductExistedForGroupSqlCmdTemplate, groupId, productId);
     DataTable data = new SqlDBHelper().ExecuteQuery(sqlCmd);
     if (data.Rows.Count > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 11
0
 /// <summary>
 /// 获取所有的有效的促销组的sortedlist集合
 /// </summary>
 /// <returns></returns>
 public static SortedList GetPromotionGroups()
 {
     SortedList list = new SortedList();
     DataTable data = new SqlDBHelper().ExecuteQuery(GetAllGroupItemsSqlCmdTemplate);
     for (int i = 0; i < data.Rows.Count; i++)
     {
         int sysNo = int.Parse(data.Rows[i]["sysNo"].ToString());
         string groupNme = data.Rows[i]["GroupName"].ToString().Trim();
         list.Add(sysNo, groupNme);
     }
     return list;
 }
Esempio n. 12
0
 /// <summary>
 /// 获取促销商品组
 /// </summary>
 /// <param name="name"></param>
 /// <param name="orderNum"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public static DataTable GetPromotionGroup(string name, string orderNum, int status)
 {
     string sqlCmd = String.Empty;
     string condition = "WHERE";
     if (name.IsSafeString())
     {
         condition += String.Concat(" GroupName LIKE '%", name, "%'");
     }
     if (orderNum.IsSafeString())
     {
         condition += GroupBuyUtility.CombineMutlQueryCondtion(condition, String.Concat(" OrderNum", orderNum));
     }
     if (status != -999999)
     {
         condition += GroupBuyUtility.CombineMutlQueryCondtion(condition, String.Concat(" Status=", status));
     }
     sqlCmd = (condition == "WHERE") ? String.Format(GetPromotionGroupSqlCmdTemplate, String.Empty) : String.Format(GetPromotionGroupSqlCmdTemplate, condition);
     SqlDBHelper dbHelper = new SqlDBHelper();
     DataTable data = dbHelper.ExecuteQuery(sqlCmd);
     return data;
 }
Esempio n. 13
0
 /// <summary>
 /// 获取一个Group下面所有的商品
 /// </summary>
 /// <param name="groupId"></param>
 /// <returns></returns>
 public static DataTable GetGroupProducts(string groupId)
 {
     string sqlCmd = String.Format(GetGroupProductsSqlCmdTemplate, groupId);
     DataTable data = new SqlDBHelper().ExecuteQuery(sqlCmd);
     return data;
 }
Esempio n. 14
0
 /// <summary>
 /// 获取当前促销单已经绑定的促销商品组
 /// </summary>
 /// <param name="promotionId"></param>
 /// <returns></returns>
 public static string GetBindedGroup(string promotionId)
 {
     DataTable data = new SqlDBHelper().ExecuteQuery(String.Format(GetBindedGroupSqlCmdTemplate, promotionId));
     if (data.Rows.Count > 0)
     {
         return data.Rows[0]["GroupName"].ToString();
     }
     else
     {
         return "当前促销未绑定商品";
     }
 }
Esempio n. 15
0
 /// <summary>
 /// 获取单条图片记录
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static ProductImgRecord GetSingleImgRecord(string id)
 {
     DataTable data = new SqlDBHelper().ExecuteQuery(String.Format(GetSingleImgRecordSqlCmdTemplate, id));
     ProductImgRecord record = new ProductImgRecord()
     {
         ProductSysNo = data.Rows[0]["SysNo"].ToString(),
         Id = data.Rows[0]["id"].ToString(),
         ProductName = data.Rows[0]["ProductName"].ToString().Trim(),
         LargeImg = data.Rows[0]["product_limg"].ToString().Trim(),
         SmallImg = data.Rows[0]["product_simg"].ToString().Trim(),
         OrderNum = int.Parse(data.Rows[0]["OrderNum"].ToString().Trim()),
         Status = int.Parse(data.Rows[0]["Status"].ToString().Trim()),
     };
     return record;
 }
Esempio n. 16
0
 /// <summary>
 /// 获取当前商品的所有图片
 /// </summary>
 /// <param name="productSysNo"></param>
 /// <returns></returns>
 public static DataTable GetProductImgs(string productSysNo)
 {
     string sqlCmd = String.Format(GetProductImgsSqlCmdTemplate, productSysNo);
     DataTable data = new SqlDBHelper().ExecuteQuery(sqlCmd);
     return data;
 }