/// <summary>
        /// 根据主键id查询信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static MattersNeedingAttentionMOD GetmodByid(int id)
        {
            MattersNeedingAttentionMOD mod = new MattersNeedingAttentionMOD();
            string sqlcommandString = "select * from MattersNeedingAttention where id=" + id;

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(sqlcommandString);
                if (reader.Read())
                {
                    mod.Contents = reader["Contents"].ToString();
                    mod.CustomerNo = reader["CustomerNo"].ToString();
                    mod.Id = Convert.ToInt32(reader["Id"].ToString());
                }
                reader.Close();
                return mod;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #2
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        int num = 0;
        if (Request.QueryString["customerNo"] != null && Request.QueryString["customerNo"].ToString() != "")
        {
            customerNo = Request.QueryString["customerNo"].ToString();
            MattersNeedingAttentionMOD mod = MattersNeedingAttentionBLL.GetmodByid(customerNo);
            if (mod != null)
            {
                mod.Contents = txtContents.Text;
                num = MattersNeedingAttentionBLL.Updatemod(mod);
            }
        }
        else
        {
            MattersNeedingAttentionMOD mod = new MattersNeedingAttentionMOD();

            mod.CustomerNo = txtCustomerNo.Text.Trim();
            mod.Contents = txtContents.Text.Trim();
            num = MattersNeedingAttentionBLL.Insertmod(mod);
        }
        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('CustomerManage/ZYSXManage.aspx')", true);

        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交失败');", true);
        }
    }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="dtomodList">数据对象</param>
 /// <returns></returns>
 public static int Updatemod(MattersNeedingAttentionMOD mod)
 {
     return MattersNeedingAttentionDAO.Updatemod(mod);
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="dtomodList">对象</param>
 /// <returns></returns>
 public static int Insertmod(MattersNeedingAttentionMOD mod)
 {
     return MattersNeedingAttentionDAO.Insertmod(mod);
 }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dtomodList">数据对象</param>
        /// <returns></returns>
        public static int Updatemod(MattersNeedingAttentionMOD mod)
        {
            string sqlCommandString = "Update MattersNeedingAttention Set contents=@contents Where id=@id";
            SqlParameter[] arParams = new SqlParameter[2];
            arParams[0] = new SqlParameter("@id", mod.Id);
            arParams[1] = new SqlParameter("@contents", mod.Contents);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dtomodList">对象</param>
        /// <returns></returns>
        public static int Insertmod(MattersNeedingAttentionMOD mod)
        {
            string sqlCommandString = "Insert Into MattersNeedingAttention(customerNo,contents)Values(@customerNo,@contents)";
            SqlParameter[] arParams = new SqlParameter[2];
            arParams[0] = new SqlParameter("@customerNo", mod.CustomerNo);
            arParams[1] = new SqlParameter("@contents", mod.Contents);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }
Example #7
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        int num = 0;

        MattersNeedingAttentionMOD mod = new MattersNeedingAttentionMOD();

        mod.CustomerNo = txtCustomerNo.Text.Trim();
        mod.Contents = txtContents.Text.Trim();
        num = MattersNeedingAttentionBLL.Insertmod(mod);
        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交成功');DetailsPageControl.ReflushList('CustomerManage/ZYSXManage.aspx')", true);

        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交失败');", true);
        }
        LoadDataBind(strWhere);
    }