Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Cms.Model.Solution GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 SolutionID,CaseTitle,Description,Solution,SucCases,ImageUrl,IsLock,SortOrder from Solutions ");
            strSql.Append(" where SolutionID=@SolutionID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SolutionID", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            Cms.Model.Solution model = new Cms.Model.Solution();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SolutionID"] != null && ds.Tables[0].Rows[0]["SolutionID"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["SolutionID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CaseTitle"] != null && ds.Tables[0].Rows[0]["CaseTitle"].ToString() != "")
                {
                    model.Title = ds.Tables[0].Rows[0]["CaseTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Solution"] != null && ds.Tables[0].Rows[0]["Solution"].ToString() != "")
                {
                    model.SolutionPlan = ds.Tables[0].Rows[0]["Solution"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Description"] != null && ds.Tables[0].Rows[0]["Description"].ToString() != "")
                {
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SucCases"] != null && ds.Tables[0].Rows[0]["SucCases"].ToString() != "")
                {
                    model.SucCases = ds.Tables[0].Rows[0]["SucCases"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ImageUrl"] != null && ds.Tables[0].Rows[0]["ImageUrl"].ToString() != "")
                {
                    model.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsLock"] != null && ds.Tables[0].Rows[0]["IsLock"].ToString() != "")
                {
                    model.IsLock = int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SortOrder"] != null && ds.Tables[0].Rows[0]["SortOrder"].ToString() != "")
                {
                    model.SortOrder = int.Parse(ds.Tables[0].Rows[0]["SortOrder"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        //添加招聘
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.caseTitle.Text.Trim().Length == 0)
            {
                strErr += "案例名称不能为空!\\n";
            }
            if (this.description.Text.Trim().Length == 0)
            {
                strErr += "案例描述不能为空!\\n";
            }
            if (this.solution.Text.Trim().Length == 0)
            {
                strErr += "解决方案不能为空!\\n";
            }
            if (this.txtImgUrl.Text.Trim().Length == 0)
            {
                strErr += "案例图片不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            Cms.Model.Solution model = new Cms.Model.Solution();
            model.Title        = this.caseTitle.Text;
            model.Description  = this.description.Text;
            model.SolutionPlan = this.solution.Text;
            model.SucCases     = this.SucCases.Text;
            model.ImageUrl     = this.txtImgUrl.Text;
            model.SortOrder    = Convert.ToInt32(sortOrder.Text);;
            model.IsLock       = Convert.ToInt32(isLock.SelectedValue);

            Cms.DAL.Solutions dal = new Cms.DAL.Solutions();
            int ReId = dal.Add(model);

            if (ReId > 0)
            {
                MessageBox.Show(this, "案例增加成功!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "产品型号信息修改成功").Show();
            }
            else
            {
                MessageBox.Show(this, "添加过程中发生错误!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "发布过程中发生错误").Show();
            }
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(Request.Params["SolutionID"] as string, out this.SolutionID))
     {
         Response.Write("<script>alert('您要查看的信息参数不正确或不存在!');history.go(-1);</script>");
         return;
     }
     if (!Page.IsPostBack)
     {
         Cms.DAL.Solutions dal = new Cms.DAL.Solutions();
         model = dal.GetModel(SolutionID);
         ShowInfo();
     }
 }
Ejemplo n.º 4
0
        //添加招聘
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.caseTitle.Text.Trim().Length == 0)
            {
                strErr += "案例名称不能为空!\\n";
            }
            if (this.description.Text.Trim().Length == 0)
            {
                strErr += "案例描述不能为空!\\n";
            }
            if (this.solution.Text.Trim().Length == 0)
            {
                strErr += "解决方案不能为空!\\n";
            }
            if (this.txtImgUrl.Text.Trim().Length == 0)
            {
                strErr += "案例图片不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            Cms.Model.Solution model = new Cms.Model.Solution();
            model.Title = this.caseTitle.Text;
            model.Description = this.description.Text;
            model.SolutionPlan = this.solution.Text;
            model.SucCases = this.SucCases.Text;
            model.ImageUrl = this.txtImgUrl.Text;
            model.SortOrder = Convert.ToInt32(sortOrder.Text); ;
            model.IsLock = Convert.ToInt32(isLock.SelectedValue);

            Cms.DAL.Solutions dal = new Cms.DAL.Solutions();
            int ReId = dal.Add(model);
            if (ReId > 0)
            {
                MessageBox.Show(this, "案例增加成功!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "产品型号信息修改成功").Show();
            }
            else
            {
                MessageBox.Show(this, "添加过程中发生错误!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "发布过程中发生错误").Show();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Cms.Model.Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Solutions set ");
            strSql.Append("CaseTitle=@CaseTitle,");
            strSql.Append("Description=@Description,");
            strSql.Append("Solution=@Solution,");
            strSql.Append("SucCases=@SucCases,");
            strSql.Append("ImageUrl=@ImageUrl,");
            strSql.Append("IsLock=@IsLock,");
            strSql.Append("SortOrder=@SortOrder");
            strSql.Append(" where solutionID=@solutionID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CaseTitle",   SqlDbType.NVarChar,  50),
                new SqlParameter("@Description", SqlDbType.NText),
                new SqlParameter("@Solution",    SqlDbType.NText),
                new SqlParameter("@SucCases",    SqlDbType.NText),
                new SqlParameter("@ImageUrl",    SqlDbType.NVarChar, 250),
                new SqlParameter("@IsLock",      SqlDbType.Int,        4),
                new SqlParameter("@SortOrder",   SqlDbType.Int,        4),
                new SqlParameter("@solutionID",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Description;
            parameters[2].Value = model.SolutionPlan;
            parameters[3].Value = model.SucCases;
            parameters[4].Value = model.ImageUrl;
            parameters[5].Value = model.IsLock;
            parameters[6].Value = model.SortOrder;
            parameters[7].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            Cms.DAL.Solutions  dal   = new Cms.DAL.Solutions();
            Cms.Model.Solution model = dal.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnlock":
                if (model.IsLock == 1)
                {
                    dal.UpdateField(id, "IsLock=0");
                }
                else
                {
                    dal.UpdateField(id, "IsLock=1");
                }
                break;
            }
            RptBind("");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Cms.Model.Solution model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Solutions(");
            strSql.Append("CaseTitle,Description,Solution,SucCases,ImageUrl,IsLock,SortOrder)");
            strSql.Append(" values (");
            strSql.Append("@CaseTitle,@Description,@Solution,@SucCases,@ImageUrl,@IsLock,@SortOrder)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CaseTitle",   SqlDbType.NVarChar,  50),
                new SqlParameter("@Description", SqlDbType.NText),
                new SqlParameter("@Solution",    SqlDbType.NText),
                new SqlParameter("@SucCases",    SqlDbType.NText),
                new SqlParameter("@ImageUrl",    SqlDbType.NVarChar, 250),
                new SqlParameter("@IsLock",      SqlDbType.Int,        4),
                new SqlParameter("@SortOrder",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Description;
            parameters[2].Value = model.SolutionPlan;
            parameters[3].Value = model.SucCases;
            parameters[4].Value = model.ImageUrl;
            parameters[5].Value = model.IsLock;
            parameters[6].Value = model.SortOrder;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Cms.Model.Solution GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 SolutionID,CaseTitle,Description,Solution,SucCases,ImageUrl,IsLock,SortOrder from Solutions ");
            strSql.Append(" where SolutionID=@SolutionID");
            SqlParameter[] parameters = {
                    new SqlParameter("@SolutionID", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            Cms.Model.Solution model = new Cms.Model.Solution();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SolutionID"] != null && ds.Tables[0].Rows[0]["SolutionID"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["SolutionID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CaseTitle"] != null && ds.Tables[0].Rows[0]["CaseTitle"].ToString() != "")
                {
                    model.Title = ds.Tables[0].Rows[0]["CaseTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Solution"] != null && ds.Tables[0].Rows[0]["Solution"].ToString() != "")
                {
                    model.SolutionPlan = ds.Tables[0].Rows[0]["Solution"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Description"] != null && ds.Tables[0].Rows[0]["Description"].ToString() != "")
                {
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SucCases"] != null && ds.Tables[0].Rows[0]["SucCases"].ToString() != "")
                {
                    model.SucCases = ds.Tables[0].Rows[0]["SucCases"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ImageUrl"] != null && ds.Tables[0].Rows[0]["ImageUrl"].ToString() != "")
                {
                    model.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsLock"] != null && ds.Tables[0].Rows[0]["IsLock"].ToString() != "")
                {
                    model.IsLock = int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SortOrder"] != null && ds.Tables[0].Rows[0]["SortOrder"].ToString() != "")
                {
                    model.SortOrder = int.Parse(ds.Tables[0].Rows[0]["SortOrder"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }