⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recorddetails.aspx.cs

📁 基于C#语言的一个企业客户管理数据库系统开发案例的源代码 ,很实用
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class RecordDetails : System.Web.UI.Page
{
    public int  flag;
    protected void Page_Load(object sender, EventArgs e)
    {    
        if (Session["flag"] == null && Session["TypeValues"]==null)
        {
            Response.Redirect("../Login.aspx");
        }
       if (!IsPostBack)
       {
           this.BindReRecordInfo();
           if (flag!=0)
           {
               this.labDate.Text = "修改于";
           }
           
       }
    }
    public void BindReRecordInfo()
    {
        int RecordID = Convert.ToInt32(Request["RecordID"]);//用Request方法来接受主页传过来的值
        Operation oper = new Operation();//生成Operation类的实例
        Records Re = new Records();//生成Records类的实例
        ReRecord Red = new ReRecord();//生成ReRecord类的实例
        if (oper.SelRecordReRecord(RecordID, Re, Red))//调用SelRecordReRecord()方法返回数据,如果返回值为True则表示工程师没有回复则把反馈日期和反馈内容都设为“无”
        {
            this.labID.Text = Re.RecordID.ToString();
            this.labTitle.Text = Re.RecordTitle;
            this.txtRecordContent.Text = Re.RecordDetails;
            this.labUserName.Text = Re.UserName;
            this.labEngineerName.Text = Re.EngineerName;
            this.txtReRecordContent.Text = "无";
            this.labDateTime.Text = "无";
        }
        else
        {
            this.labID.Text = Re.RecordID.ToString();
            this.labTitle.Text = Re.RecordTitle;
            this.txtRecordContent.Text = Re.RecordDetails;
            this.labUserName.Text = Re.UserName;
            this.labEngineerName.Text = Re.EngineerName;
            this.txtReRecordContent.Text = Red.ReReordContent;
            this.labDateTime.Text = Red.RevertDate.ToString();
            flag =int.Parse( Red.Flag.ToString());
            int TypeValues = Convert.ToInt32(Session["TypeValues"]);//取得用户登录类型的状态值
            if (this.labEngineerName.Text == Session["UserName"].ToString() && TypeValues == 1)//如果该记录的指定工程师和用户登录类型为工程师的用户名一致,显示修改按钮
            {
                this.btnAmend.Visible = true;
            }

        }
       
    }
    protected void btnAmend_Click(object sender, EventArgs e)
    {
        int RecordID = int.Parse(this.labID.Text);//取得发布信息ID
        string ReRecordContent = this.txtReRecordContent.Text.Trim();
        DateTime dt=DateTime.Now;
        Operation oper = new Operation();
        if (oper.UpdateReRecordInfo(RecordID, ReRecordContent,dt))//调用UpdateReRecordInfo()方法修改反馈内容
        {
            
            Response.Write("<script>alert('修改成功!')</script>");
            this.labDate.Text = "修改于";
        }
        else
        {
            Response.Write("<script>alert('修改失败!');location='RecordDetails.aspx'</script>");
        }
    }
    protected void txtReRecordContent_TextChanged(object sender, EventArgs e)
    {
        this.btnAmend.Enabled = true;//如果用户修改了反馈内容则修改按钮是可用的 
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -