コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //測試用
        //DIALOG_USER data_User = SQLFunc.Get_DIALOG_USER("1", "Athena", "192.168.7.127", "2017-03-23 14:29:15.647");
        //Session["DIALOG_USER"] = data_User;

        if (!IsPostBack)
        {
            txt_Sentence.Attributes.Add("onkeydown", "if(event.keyCode == 13) {document.getElementById('" + btn_Submit.ClientID + "').click(); return false;}");
        }

        if (Session["DIALOG_USER"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            MotionClass.DIALOG_USER DIALOG_USER = (MotionClass.DIALOG_USER)Session["DIALOG_USER"];
            if (Request["DM_ID"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                string    DM_ID = Request["DM_ID"].ToString();
                DataTable dt    = SQLFunc.Get_DIALOG_MAIN(DM_ID);
                Page_Bind(dt);
                ll_Name.Text = DIALOG_USER.U_Name;
            }
        }
        //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "scrollTo", "window.scrollTo(0,document.body.scrollHeight);alert('aa');", true);
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //測試用
        MotionClass.DIALOG_USER DIALOG_USER = (MotionClass.DIALOG_USER)Session["DIALOG_USER"];
        Session["DIALOG_USER"] = DIALOG_USER;

        if (Session["dialog_user"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            //    DIALOG_USER DIALOG_USER = (DIALOG_USER)Session["DIALOG_USER"];
            //    if (Request["DM_ID"] == null)
            //    {
            //        Response.Redirect("../Default.aspx");
            //    }
            //    else
            //    {
            //        string DM_ID = Request["DM_ID"].ToString();
            //        DataTable dt = SQLFunc.Get_DIALOG_MAIN(DM_ID);
            //        Page_Bind(dt);
            //        ll_Name.Text = DIALOG_USER.U_Name;
            //    }
        }
        //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "scrollTo", "window.scrollTo(0,document.body.scrollHeight);alert('aa');", true);
    }
コード例 #3
0
 public static MotionClass.DIALOG_USER Get_DIALOG_USER(string U_ID, string U_Name, string U_IP, string U_CreateTime)
 {
     MotionClass.DIALOG_USER data = new MotionClass.DIALOG_USER();
     data.U_ID         = U_ID;
     data.U_Name       = U_Name;
     data.U_IP         = U_IP;
     data.U_CreateTime = U_CreateTime;
     return(data);
 }
コード例 #4
0
    public static string Add_DIALOG_USER(MotionClass.DIALOG_USER data)
    {
        var cmd = new SqlCommand();

        cmd.CommandText = "Insert into DIALOG_USER (U_IP, U_Name, U_CreateTime) values (@U_IP, @U_Name, @U_CreateTime) ";
        cmd.Parameters.Add("U_IP", SqlDbType.NVarChar).Value         = data.U_IP;
        cmd.Parameters.Add("U_Name", SqlDbType.NVarChar).Value       = data.U_Name;
        cmd.Parameters.Add("U_CreateTime", SqlDbType.NVarChar).Value = data.U_CreateTime;
        cmd.CommandText += "select @@IDENTITY ";
        DataTable dt = Persister.Execute(cmd);
        string    id = dt.Rows[0][0].ToString();

        return(id);
    }
コード例 #5
0
ファイル: Login.aspx.cs プロジェクト: athena830/Study.Web
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txt_Name.Attributes.Add("onkeydown", "if(event.keyCode == 13) {document.getElementById('" + btn_Save.ClientID + "').click(); return false;}");
            string ip_string = GetClientIP();

            lb_IP.Text = ip_string;
            DataTable dt = SQLFunc.Get_DIALOG_USER(ip_string);
            if (dt.Rows.Count > 0)
            {
                txt_Name.Text  = dt.Rows[0]["U_Name"].ToString();
                hid_U_ID.Value = dt.Rows[0]["U_ID"].ToString();
                MotionClass.DIALOG_USER data = SQLFunc.Get_DIALOG_USER(dt.Rows[0]["U_ID"].ToString(), dt.Rows[0]["U_Name"].ToString(), dt.Rows[0]["U_IP"].ToString(), dt.Rows[0]["U_CreateTime"].ToString());
                Session["DIALOG_USER"] = data;
            }
            else
            {
                Session.Clear();
            }
        }
    }
コード例 #6
0
ファイル: Login.aspx.cs プロジェクト: athena830/Study.Web
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        MotionClass.DIALOG_USER data = null;
        string now_date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        string name     = txt_Name.Text;

        if (string.IsNullOrEmpty(name))
        {
            Alert_msg("交出名字,饒你一命");
        }
        else
        {
            if (name == "gis@5200")
            {
                data = SQLFunc.Get_DIALOG_USER("", "Manager", lb_IP.Text, now_date);
                Session["DIALOG_USER"] = data;

                Response.Redirect("~/Page/Summary.aspx");
            }
            else
            {
                if (Session["DIALOG_USER"] == null)
                {
                    data = SQLFunc.Get_DIALOG_USER("", name, lb_IP.Text, now_date);
                    string U_ID = SQLFunc.Add_DIALOG_USER(data);
                    data = SQLFunc.Get_DIALOG_USER(U_ID, name, lb_IP.Text, now_date);
                    Session["DIALOG_USER"] = data;
                }

                MotionClass.DIALOG_USER data_USER = (MotionClass.DIALOG_USER)Session["DIALOG_USER"];
                MotionClass.DIALOG_MAIN data_Main = SQLFunc.Get_DIALOG_MAIN(data_USER.U_ID, "0", now_date);
                string DM_ID = SQLFunc.Add_DIALOG_MAIN(data_Main);
                //string DM_ID = "1";
                Response.Redirect("Page/Dialog.aspx?DM_ID=" + DM_ID);
            }
        }
    }