Exemplo n.º 1
0
        protected void LinkButton_Del_Click1(object sender, EventArgs e)
        {
            //获得ID
            try
            {
                string strId = ((ImageButton)sender).CommandArgument.ToString();

                //通过ID获得实体类
                notePadModel = notePadBll.GetModel(int.Parse(strId));
                //定义物理删除
                int Delflag = 1;
                notePadModel.DELFLAG = Delflag;
                //删除后更新
                notePadBll.Update(notePadModel);
                Label_notice.Text = "删除成功!";

                setRowCout();
                ShowKcList(int.Parse(pageindexHidden.Value.ToString()));
                Dianda.BLL.SYS_LogsExt bsyslog    = new Dianda.BLL.SYS_LogsExt();
                Model.USER_Users       user_model = (Model.USER_Users)Session["USER_Users"];

                bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "删除人员信息", "删除" + user_model.REALNAME + "(" + user_model.USERNAME + ")" + "成功");
            }
            catch (Exception)
            {
                Label_notice.Text = "删除失败!";
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Dianda.Model.Personal_Notepad model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Personal_Notepad set ");
            strSql.Append("NAMES=@NAMES,");
            strSql.Append("DELFLAG=@DELFLAG,");
            strSql.Append("DATETIME=@DATETIME,");
            strSql.Append("UserID=@UserID");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",       SqlDbType.Int,         4),
                new SqlParameter("@NAMES",    SqlDbType.VarChar,   500),
                new SqlParameter("@DELFLAG",  SqlDbType.Int,         4),
                new SqlParameter("@DATETIME", SqlDbType.DateTime),
                new SqlParameter("@UserID",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.NAMES;
            parameters[2].Value = model.DELFLAG;
            parameters[3].Value = model.DATETIME;
            parameters[4].Value = model.UserID;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Dianda.Model.Personal_Notepad model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Personal_Notepad(");
            strSql.Append("NAMES,DELFLAG,DATETIME,UserID)");
            strSql.Append(" values (");
            strSql.Append("@NAMES,@DELFLAG,@DATETIME,@UserID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NAMES",    SqlDbType.VarChar,   500),
                new SqlParameter("@DELFLAG",  SqlDbType.Int,         4),
                new SqlParameter("@DATETIME", SqlDbType.DateTime),
                new SqlParameter("@UserID",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.NAMES;
            parameters[1].Value = model.DELFLAG;
            parameters[2].Value = model.DATETIME;
            parameters[3].Value = model.UserID;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        protected void Button_add_Click(object sender, EventArgs e)
        {
            //便签实体类
            Dianda.Model.Personal_Notepad notepadModel = new Dianda.Model.Personal_Notepad();
            //便签操作类
            Dianda.BLL.Personal_Notepad notepadBll = new Dianda.BLL.Personal_Notepad();
            //通用操作类
            Dianda.COMMON.common commonId = new Dianda.COMMON.common();
            try
            {
                if (TextBox_noteContent.Text.Equals("") || TextBox_noteContent.Text.Equals("便签内容不能为空"))
                {
                    Label_notice.Text = "便签内容不能为空";
                }
                else
                {
                    Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"];

                    //便签内容
                    notepadModel.NAMES = TextBox_noteContent.Text.ToString();
                    //便签状态
                    notepadModel.DELFLAG = 0;
                    //建立便签时间
                    notepadModel.DATETIME = DateTime.Now;
                    //用户ID
                    notepadModel.UserID = user_model.ID.ToString();
                    //添加数据到数据库
                    notepadBll.Add(notepadModel);

                    //添加到日志`
                    Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt();

                    bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "添加便签", "添加成功");
                    // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "a", "location.href='test.aspx';alert('添加成功');", true);
                    Label_notice.Text = "添加成功!";
                }
            }
            catch (Exception)
            {
                // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "a", "altert('添加失败');parent.parent.location.reload();", true);
                Label_notice.Text = "添加失败!";
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Dianda.Model.Personal_Notepad GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,NAMES,DELFLAG,DATETIME,UserID from Personal_Notepad ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.NAMES = ds.Tables[0].Rows[0]["NAMES"].ToString();
                if (ds.Tables[0].Rows[0]["DELFLAG"].ToString() != "")
                {
                    model.DELFLAG = int.Parse(ds.Tables[0].Rows[0]["DELFLAG"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DATETIME"].ToString() != "")
                {
                    model.DATETIME = DateTime.Parse(ds.Tables[0].Rows[0]["DATETIME"].ToString());
                }
                model.UserID = ds.Tables[0].Rows[0]["UserID"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }