예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Utils.CheckRole("7"))
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('权限信息','没有权限!','/Systestcomjun/index.aspx',2)</script>");
         return;
     }
     if (!IsPostBack)
     {
         txtSort.Text  = "20";
         ltlTitle.Text = "新增职场攻略";
         ZhongLi.Model.siteconfig site = new ZhongLi.Bll.siteconfig().loadConfig(Server.MapPath("/xmlconfig/site.config"));
         imgformat = site.ImgFormat;
         if (Request.QueryString["CPID"] != null)
         {
             ltlTitle.Text = "修改职场攻略";
             int CPID = Convert.ToInt32(Request.QueryString["CPID"]);
             ZhongLi.Model.CareerPlanning cp = bll.GetModel(CPID);
             rbtType.SelectedValue = cp.CPType;
             txtCPTitle.Text       = cp.CPTitle;
             txtCPName.Text        = cp.CPName;
             txtPhone.Text         = cp.Phone;
             txtSort.Text          = cp.Sort + "";
             txtAbsDes.Text        = cp.AbsDes;
             txtCPDes.Text         = cp.CPDes;
             if (cp.ImgUrl != "")
             {
                 img_Photo.ImageUrl = cp.ImgUrl;
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(ZhongLi.Model.CareerPlanning model)
        {
            int rowsAffected = 0;
            SqlParameter[] parameters = {
					new SqlParameter("@CPID", SqlDbType.Int,4),
					new SqlParameter("@CPType", SqlDbType.NVarChar,50),
					new SqlParameter("@CPName", SqlDbType.NVarChar,50),
					new SqlParameter("@CPTitle", SqlDbType.NVarChar,50),
					new SqlParameter("@Phone", SqlDbType.NVarChar,50),
					new SqlParameter("@CreateTime", SqlDbType.DateTime),
					new SqlParameter("@CPDes", SqlDbType.NVarChar,-1),
					new SqlParameter("@Sort", SqlDbType.Int,4),
					new SqlParameter("@ImgUrl", SqlDbType.NVarChar,200),
					new SqlParameter("@AbsDes", SqlDbType.NVarChar,200)};
            parameters[0].Value = model.CPID;
            parameters[1].Value = model.CPType;
            parameters[2].Value = model.CPName;
            parameters[3].Value = model.CPTitle;
            parameters[4].Value = model.Phone;
            parameters[5].Value = model.CreateTime;
            parameters[6].Value = model.CPDes;
            parameters[7].Value = model.Sort;
            parameters[8].Value = model.ImgUrl;
            parameters[9].Value = model.AbsDes;

            DbHelperSQL.RunProcedure("CareerPlanning_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(ZhongLi.Model.CareerPlanning model)
        {
            int rowsAffected;
            SqlParameter[] parameters = {
					new SqlParameter("@CPID", SqlDbType.Int,4),
					new SqlParameter("@CPType", SqlDbType.NVarChar,50),
					new SqlParameter("@CPName", SqlDbType.NVarChar,50),
					new SqlParameter("@CPTitle", SqlDbType.NVarChar,50),
					new SqlParameter("@Phone", SqlDbType.NVarChar,50),
					new SqlParameter("@CreateTime", SqlDbType.DateTime),
					new SqlParameter("@CPDes", SqlDbType.NVarChar,-1),
					new SqlParameter("@Sort", SqlDbType.Int,4),
					new SqlParameter("@ImgUrl", SqlDbType.NVarChar,200),
					new SqlParameter("@AbsDes", SqlDbType.NVarChar,200)};
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value = model.CPType;
            parameters[2].Value = model.CPName;
            parameters[3].Value = model.CPTitle;
            parameters[4].Value = model.Phone;
            parameters[5].Value = model.CreateTime;
            parameters[6].Value = model.CPDes;
            parameters[7].Value = model.Sort;
            parameters[8].Value = model.ImgUrl;
            parameters[9].Value = model.AbsDes;

            DbHelperSQL.RunProcedure("CareerPlanning_ADD", parameters, out rowsAffected);
            return (int)parameters[0].Value;
        }
예제 #4
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            ZhongLi.Model.CareerPlanning cp = null;
            if (Request.QueryString["CPID"] != null)
            {
                cp = bll.GetModel(Convert.ToInt32(Request.QueryString["CPID"]));
            }
            else
            {
                cp = new ZhongLi.Model.CareerPlanning();
            }
            cp.CPTitle = txtCPTitle.Text;
            cp.CPName  = txtCPName.Text;
            cp.Phone   = txtPhone.Text;
            cp.CPType  = rbtType.SelectedValue;
            cp.Sort    = Convert.ToInt32(txtSort.Text);
            cp.AbsDes  = txtAbsDes.Text;
            cp.CPDes   = txtCPDes.Text;

            ZhongLi.Model.siteconfig site = new ZhongLi.Bll.siteconfig().loadConfig(Server.MapPath("/xmlconfig/site.config"));
            if (fileImg.HasFile)
            {
                if (fileImg.PostedFile.ContentLength <= site.FileSize * 1024)
                {
                    string fileExt  = Utils.GetFileExt(fileImg.FileName);
                    string newname  = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "." + fileExt;
                    string filePath = Utils.GetMapPath("/upload/news/") + newname;
                    fileImg.SaveAs(filePath);
                    cp.ImgUrl = "/upload/news/" + newname;
                }
            }
            if (cp.CPID == 0)
            {
                if (bll.Add(cp) > 0)
                {
                    webHelper.addLog("新添加了职场攻略“" + cp.CPTitle + "”");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('新增职场攻略','保存成功!','',1)</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('新增职场攻略','保存失败','',2)</script>");
                }
            }
            else
            {
                if (bll.Update(cp))
                {
                    webHelper.addLog("修改了职场攻略“" + cp.CPTitle + "”");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑职场攻略','保存成功!','',1)</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑职场攻略','保存失败','',2);</script>");
                }
            }
        }
예제 #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZhongLi.Model.CareerPlanning DataRowToModel(DataRow row)
 {
     ZhongLi.Model.CareerPlanning model = new ZhongLi.Model.CareerPlanning();
     if (row != null)
     {
         if (row["CPID"] != null && row["CPID"].ToString() != "")
         {
             model.CPID = int.Parse(row["CPID"].ToString());
         }
         if (row["CPType"] != null)
         {
             model.CPType = row["CPType"].ToString();
         }
         if (row["CPName"] != null)
         {
             model.CPName = row["CPName"].ToString();
         }
         if (row["CPTitle"] != null)
         {
             model.CPTitle = row["CPTitle"].ToString();
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["CPDes"] != null)
         {
             model.CPDes = row["CPDes"].ToString();
         }
         if (row["Sort"] != null && row["Sort"].ToString() != "")
         {
             model.Sort = int.Parse(row["Sort"].ToString());
         }
         if (row["ImgUrl"] != null)
         {
             model.ImgUrl = row["ImgUrl"].ToString();
         }
         if (row["AbsDes"] != null)
         {
             model.AbsDes = row["AbsDes"].ToString();
         }
     }
     return model;
 }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZhongLi.Model.CareerPlanning GetModel(int CPID)
        {
            SqlParameter[] parameters = {
					new SqlParameter("@CPID", SqlDbType.Int,4)
			};
            parameters[0].Value = CPID;

            ZhongLi.Model.CareerPlanning model = new ZhongLi.Model.CareerPlanning();
            DataSet ds = DbHelperSQL.RunProcedure("CareerPlanning_GetModel", parameters, "ds");
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BindNews();
            string type = Request["type"];
            string id   = Request["id"];

            switch (type)
            {
            case "news":
                NEWM  = NEW.GetModel(Convert.ToInt32(id));
                title = NEWM.Title;
                count = NEWM.NewsCon;
                time  = "发表时间:" + NEWM.CreateTime.ToString();
                break;

            case "jo":
                jom   = jo.GetModel(Convert.ToInt32(id));
                title = jom.JobTraTitle;
                count = jom.JobTraDes;
                time  = "";
                break;

            case "cp":
                cpm   = cp.GetModel(Convert.ToInt32(id));
                title = cpm.CPTitle;
                count = cpm.CPDes;
                time  = "发表时间:" + cpm.CreateTime.ToString();
                break;
            }
            ZhongLi.Model.siteconfig config = new ZhongLi.Bll.siteconfig().loadConfig(Server.MapPath("/xmlconfig/site.config"));
            log    = config.log;
            phone  = config.phone;
            mail   = config.mail;
            bjtu   = config.bgtu;
            QRCode = config.QRCode;
        }