Exemplo n.º 1
0
        /// <summary>
        /// 修改商家配置
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool UpdateSupplierCfg(SupplierConfigInfo info)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update Ecshop_SupplierConfig set ");
            stringBuilder.Append("ShortDesc=@ShortDesc,");
            stringBuilder.Append("ImageUrl=@ImageUrl,");
            stringBuilder.Append("DisplaySequence=@DisplaySequence,");
            stringBuilder.Append("Type=@Type,");
            stringBuilder.Append("Client=@Client,");
            stringBuilder.Append("IsDisable=@IsDisable,");
            stringBuilder.Append("SupplierId=@SupplierId");

            stringBuilder.Append(" where Id=@Id ");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());

            this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, info.Id);
            this.database.AddInParameter(sqlStringCommand, "ShortDesc", DbType.String, info.ShortDesc);
            this.database.AddInParameter(sqlStringCommand, "ImageUrl", DbType.String, info.ImageUrl);
            this.database.AddInParameter(sqlStringCommand, "DisplaySequence", DbType.String, info.DisplaySequence);
            this.database.AddInParameter(sqlStringCommand, "Type", DbType.Int32, info.Type);
            this.database.AddInParameter(sqlStringCommand, "Client", DbType.Int32, info.Client);
            this.database.AddInParameter(sqlStringCommand, "IsDisable", DbType.Boolean, info.IsDisable);
            this.database.AddInParameter(sqlStringCommand, "SupplierId", DbType.Int32, info.SupplierId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Exemplo n.º 2
0
        private void SetSupplierCfg(int id)
        {
            SupplierConfigInfo info = SupplierConfigHelper.GetSupplierCfgById(this.id);

            this.ddlSupplier.SelectedValue = info.SupplierId.ToString();

            this.txtDesc.Text = info.ShortDesc;

            this.littlepic.Src = info.ImageUrl;
            this.fmSrc.Value   = info.ImageUrl;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取商家配置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SupplierConfigInfo GetSupplierCfgById(int id)
        {
            StringBuilder stringBuilder    = new StringBuilder(" select * from Ecshop_SupplierConfig where Id=@Id");
            DbCommand     sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());

            this.database.AddInParameter(sqlStringCommand, "Id", DbType.Int32, id);
            SupplierConfigInfo result = null;

            using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                result = ReaderConvert.ReaderToModel <SupplierConfigInfo>(dataReader);
            }
            return(result);
        }
Exemplo n.º 4
0
        public static void SwapSupplierCfgSequence(int Id, int replaceId)
        {
            SupplierConfigDao  supplierConfigDao = new SupplierConfigDao();
            SupplierConfigInfo info        = supplierConfigDao.GetSupplierCfgById(Id);
            SupplierConfigInfo replaceInfo = supplierConfigDao.GetSupplierCfgById(replaceId);

            if (info != null && replaceInfo != null)
            {
                int displaySequence = info.DisplaySequence;
                info.DisplaySequence        = replaceInfo.DisplaySequence;
                replaceInfo.DisplaySequence = displaySequence;
                supplierConfigDao.UpdateSupplierCfg(info);
                supplierConfigDao.UpdateSupplierCfg(replaceInfo);
            }
        }
Exemplo n.º 5
0
        protected void btnAddSupplier_Click(object sender, System.EventArgs e)
        {
            if (this.id == 0)
            {
                SupplierConfigInfo info = new SupplierConfigInfo();
                info.IsDisable  = false;
                info.ImageUrl   = this.fmSrc.Value;
                info.ShortDesc  = this.txtDesc.Text;
                info.Client     = (int)ClientType.App;
                info.Type       = (int)SupplierCfgType.Hot;
                info.SupplierId = int.Parse(this.ddlSupplier.SelectedValue);
                if (string.IsNullOrWhiteSpace(info.ImageUrl))
                {
                    this.ShowMsg("请上传图片!", false);
                    return;
                }
                if (SupplierConfigHelper.SaveSupplierCfg(info) > 0)
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("添加错误!", false);
            }

            else
            {
                SupplierConfigInfo info = SupplierConfigHelper.GetSupplierCfgById(this.id);
                info.IsDisable  = false;
                info.ImageUrl   = this.fmSrc.Value;
                info.ShortDesc  = this.txtDesc.Text;
                info.SupplierId = int.Parse(this.ddlSupplier.SelectedValue);
                if (SupplierConfigHelper.UpdateSupplierCfg(info))
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("修改失败!", false);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加商家配置
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int SaveSupplierCfg(SupplierConfigInfo info)
        {
            int           result;
            int           displaySequence = this.GetMaxSupplierCfgSequence();
            StringBuilder stringBuilder   = new StringBuilder("insert into  Ecshop_SupplierConfig (ShortDesc,ImageUrl,DisplaySequence,Client,IsDisable,SupplierId,Type)");

            stringBuilder.Append("values (@ShortDesc,@ImageUrl,@DisplaySequence,@Client,@IsDisable,@SupplierId,@Type);select @@IDENTITY");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ShortDesc", DbType.String, info.ShortDesc);
            this.database.AddInParameter(sqlStringCommand, "ImageUrl", DbType.String, info.ImageUrl);
            this.database.AddInParameter(sqlStringCommand, "DisplaySequence", DbType.String, displaySequence);
            this.database.AddInParameter(sqlStringCommand, "Client", DbType.Int32, info.Client);
            this.database.AddInParameter(sqlStringCommand, "IsDisable", DbType.Boolean, info.IsDisable);
            this.database.AddInParameter(sqlStringCommand, "SupplierId", DbType.Int32, info.SupplierId);
            this.database.AddInParameter(sqlStringCommand, "Type", DbType.Int32, info.Type);

            if (!int.TryParse(this.database.ExecuteScalar(sqlStringCommand).ToString(), out result))
            {
                result = 0;
            }

            return(result);
        }
Exemplo n.º 7
0
 /// <summary>
 /// 修改商家配置
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool UpdateSupplierCfg(SupplierConfigInfo info)
 {
     return(new SupplierConfigDao().UpdateSupplierCfg(info));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 添加商家配置
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static int SaveSupplierCfg(SupplierConfigInfo info)
 {
     return(new SupplierConfigDao().SaveSupplierCfg(info));
 }