Exemplo n.º 1
0
        /// <summary>
        /// 根据公司ID获取公司品牌信息
        /// </summary>
        /// <param name="companyId">公司ID</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.CompanyStructure.CompanyBrand> GetBrandByCompanyId(int companyId)
        {
            IList <EyouSoft.Model.CompanyStructure.CompanyBrand> totals = new List <EyouSoft.Model.CompanyStructure.CompanyBrand>();

            EyouSoft.Model.CompanyStructure.CompanyBrand model = null;
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_GetBrandByCompanyId);

            this._db.AddInParameter(cmd, "CompanyId", DbType.Int32, companyId);

            using (IDataReader rdr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(cmd, this._db))
            {
                while (rdr.Read())
                {
                    model            = new EyouSoft.Model.CompanyStructure.CompanyBrand();
                    model.Id         = rdr.GetInt32(rdr.GetOrdinal("Id"));
                    model.BrandName  = rdr.GetString(rdr.GetOrdinal("BrandName"));
                    model.Logo1      = rdr.IsDBNull(rdr.GetOrdinal("Logo1")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo1"));
                    model.Logo2      = rdr.IsDBNull(rdr.GetOrdinal("Logo2")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo2"));
                    model.CompanyId  = rdr.GetInt32(rdr.GetOrdinal("CompanyId"));
                    model.OperatorId = rdr.GetInt32(rdr.GetOrdinal("OperatorId"));
                    model.IssueTime  = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    model.IsDelete   = Convert.ToBoolean(rdr.GetOrdinal("IsDelete"));
                    totals.Add(model);
                }
            }

            return(totals);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 分页获取公司产品列表
        /// </summary>
        /// <param name="PageSize">每页显示条数</param>
        /// <param name="PageIndex">当前页码</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="CompanyId">公司编号</param>
        /// <returns>公司产品列表</returns>
        public IList <EyouSoft.Model.CompanyStructure.CompanyBrand> GetList(int PageSize, int PageIndex, ref int RecordCount, int CompanyId)
        {
            IList <EyouSoft.Model.CompanyStructure.CompanyBrand> totals = new List <EyouSoft.Model.CompanyStructure.CompanyBrand>();

            string tableName     = "tbl_CompanyBrands";
            string primaryKey    = "Id";
            string orderByString = "IssueTime DESC";
            string fields        = " Id,BrandName,Logo1,Logo2,OperatorId,IssueTime,CompanyId,IsDelete";

            StringBuilder cmdQuery = new StringBuilder(" IsDelete='0' ");

            cmdQuery.AppendFormat(" and CompanyId='{0}' ", CompanyId);

            using (IDataReader rdr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(this._db, PageSize, PageIndex, ref RecordCount, tableName, primaryKey, fields, cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    EyouSoft.Model.CompanyStructure.CompanyBrand companyBrandInfo = new EyouSoft.Model.CompanyStructure.CompanyBrand();

                    companyBrandInfo.Id         = rdr.GetInt32(rdr.GetOrdinal("Id"));
                    companyBrandInfo.BrandName  = rdr.GetString(rdr.GetOrdinal("BrandName"));
                    companyBrandInfo.Logo1      = rdr.IsDBNull(rdr.GetOrdinal("Logo1")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo1"));
                    companyBrandInfo.Logo2      = rdr.IsDBNull(rdr.GetOrdinal("Logo2")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo2"));
                    companyBrandInfo.CompanyId  = rdr.GetInt32(rdr.GetOrdinal("CompanyId"));
                    companyBrandInfo.OperatorId = rdr.GetInt32(rdr.GetOrdinal("OperatorId"));
                    companyBrandInfo.IssueTime  = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    companyBrandInfo.IsDelete   = Convert.ToBoolean(rdr.GetOrdinal("IsDelete"));

                    totals.Add(companyBrandInfo);
                }
            }

            return(totals);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取公司产品实体
        /// </summary>
        /// <param name="Id">主键编号</param>
        /// <returns></returns>
        public EyouSoft.Model.CompanyStructure.CompanyBrand GetModel(int Id)
        {
            EyouSoft.Model.CompanyStructure.CompanyBrand companyBrandModel = null;
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_CompanyBrand);

            this._db.AddInParameter(cmd, "Id", DbType.Int32, Id);

            using (IDataReader rdr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(cmd, this._db))
            {
                if (rdr.Read())
                {
                    companyBrandModel            = new EyouSoft.Model.CompanyStructure.CompanyBrand();
                    companyBrandModel.Id         = rdr.GetInt32(rdr.GetOrdinal("Id"));
                    companyBrandModel.BrandName  = rdr.GetString(rdr.GetOrdinal("BrandName"));
                    companyBrandModel.Logo1      = rdr.IsDBNull(rdr.GetOrdinal("Logo1")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo1"));
                    companyBrandModel.Logo2      = rdr.IsDBNull(rdr.GetOrdinal("Logo2")) ? "" : rdr.GetString(rdr.GetOrdinal("Logo2"));
                    companyBrandModel.CompanyId  = rdr.GetInt32(rdr.GetOrdinal("CompanyId"));
                    companyBrandModel.OperatorId = rdr.GetInt32(rdr.GetOrdinal("OperatorId"));
                    companyBrandModel.IssueTime  = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    companyBrandModel.IsDelete   = Convert.ToBoolean(rdr.GetOrdinal("IsDelete"));
                }
            }

            return(companyBrandModel);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model">公司产品实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Update(EyouSoft.Model.CompanyStructure.CompanyBrand model)
        {
            bool result = false;

            result = Dal.Update(model);
            handleLogsBll.Add(AddLogs("修改", result));

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model">公司产品实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(EyouSoft.Model.CompanyStructure.CompanyBrand model)
        {
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_INSERT_CompanyBrand);

            this._db.AddInParameter(cmd, "BrandName", DbType.String, model.BrandName);
            this._db.AddInParameter(cmd, "Logo1", DbType.String, model.Logo1);
            this._db.AddInParameter(cmd, "Logo2", DbType.String, model.Logo2);
            this._db.AddInParameter(cmd, "OperatorId", DbType.Int32, model.OperatorId);
            this._db.AddInParameter(cmd, "CompanyId", DbType.Int32, model.CompanyId);
            this._db.AddInParameter(cmd, "IsDelete", DbType.String, model.IsDelete == true ? "1" : "0");

            return(EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(cmd, this._db) > 0 ? true : false);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model">公司产品实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Update(EyouSoft.Model.CompanyStructure.CompanyBrand model)
        {
            if (model == null || model.Id <= 0)
            {
                return(false);
            }

            DbCommand     cmd       = null;
            StringBuilder updateStr = new StringBuilder();

            updateStr.AppendFormat(" set Logo1 = '{0}' ", string.IsNullOrEmpty(model.Logo1) ? string.Empty : model.Logo1);
            updateStr.AppendFormat(" ,Logo2 = '{0}' ", string.IsNullOrEmpty(model.Logo2) ? string.Empty : model.Logo2);
            updateStr.AppendFormat(" ,BrandName = '{0}' ", string.IsNullOrEmpty(model.BrandName) ? string.Empty : model.BrandName);
            updateStr.AppendFormat(" where Id = {0} ", model.Id);

            cmd = this._db.GetSqlStringCommand(SQL_UPDATE_CompanyBrand + updateStr);

            return(EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(cmd, this._db) > 0 ? true : false);
        }
Exemplo n.º 7
0
        protected string logOutUrl = string.Empty; //外品牌
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断权限
            if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_基础设置_品牌管理栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_基础设置_品牌管理栏目, false);
                return;
            }
            brandName = Utils.GetFormValue("txtBrand");                           //获取报价
            int    brandId  = Utils.GetInt(Utils.GetQueryStringValue("brandId")); //品牌Id
            string method   = Utils.GetFormValue("hidMethod");                    //获取当前操作(保存/继续)
            string showMess = "数据保存完成";                                           //提示消息

            EyouSoft.Model.CompanyStructure.CompanyBrand brandModel = null;
            EyouSoft.BLL.CompanyStructure.CompanyBrand   brandBll   = new EyouSoft.BLL.CompanyStructure.CompanyBrand();//初始化bll
            //无操作方式则为初次加载数据
            if (method == "")
            {
                #region 初始化数据
                if (brandId != 0)
                {
                    brandModel = brandBll.GetModel(brandId);
                    if (brandModel != null)
                    {
                        brandName = brandModel.BrandName;
                        logInUrl  = !string.IsNullOrEmpty(brandModel.Logo1) ? string.Format("<div id='file' style='float:left'><a href='{0}' target='_blank'>查看图片<a><img src='../../images/closebox2.gif' id='del_file'/></div>", brandModel.Logo1) : "暂无内Logo";
                        if (brandModel.Logo1 != "")
                        {
                            hid_file.Value = brandModel.Logo1;
                        }
                    }
                    return;
                }
                #endregion
            }
            else
            {
                #region 保存数据
                if (brandName == "")
                {
                    MessageBox.Show(this, "品牌名称不为空!");
                    return;
                }
                bool result = false;
                brandModel = new EyouSoft.Model.CompanyStructure.CompanyBrand();
                string         logoPath = string.Empty;
                string         oldName  = string.Empty;
                HttpPostedFile inLogo   = Request.Files["inLogo"];//内Logo

                if (inLogo != null)
                {
                    result = UploadFile.FileUpLoad(inLogo, "systemset", out logoPath, out oldName);//上传内logo
                }
                else
                {
                    result = true;
                }
                if (result)//如果成功则上传内logo
                {
                    if (inLogo != null)
                    {
                        if (logoPath != "")
                        {
                            hid_file.Value = logoPath;
                        }
                    }
                    if (hid_file.Value == "")
                    {
                        brandModel.Logo1 = null;
                    }
                    else
                    {
                        brandModel.Logo1 = hid_file.Value;
                    }


                    brandModel.BrandName  = brandName;
                    brandModel.CompanyId  = CurrentUserCompanyID;
                    brandModel.OperatorId = 0;
                    brandModel.IssueTime  = DateTime.Now;
                }
                if (result)//如果logo上传成功则执行保存
                {
                    if (brandId != 0)
                    {
                        brandModel.Id = brandId;
                        result        = brandBll.Update(brandModel);//修改品牌
                    }
                    else
                    {
                        result = brandBll.Add(brandModel);//添加品牌
                    }
                }
                if (!result)
                {
                    showMess = "数据保存失败!";
                }
                //继续添加则刷新页面,否则关闭当前窗口
                if (method == "continue")
                {
                    MessageBox.ShowAndRedirect(this, showMess, "BrandEdit.aspx");
                }
                else
                {
                    MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.location='/systemset/basicinfo/BrandManage.aspx';window.parent.Boxy.getIframeDialog('{1}').hide();", showMess, Utils.GetQueryStringValue("iframeId")));
                }
                #endregion
            }
        }