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

📄 addfix.aspx.cs

📁 物业管理系统
💻 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 admin_Default2 : System.Web.UI.Page
{
    BaseClass bc = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
       
            if (Convert.ToString(Session["UID"]) == "")
            {
                Response.Redirect("login.aspx");

            }
            else
            {
                DataSet ds = null;
                int p_int_newCode = 0;
                string P_string_newcode = "";
                ds = bc.ExecDS("select * from fixManager order by fixID");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    txtfixCode.Text = DateTime.Now.ToString("yyyy-MM-dd") + "FM100001";
                }
                else
                {
                 //   Response.Write(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["fixID"]) ;
                   // Response.End();
                   
                    
                    P_string_newcode = Convert.ToString(ds.Tables[0].Rows[ds.Tables[0].Rows.Count-1]["fixID"]);
                  //  Response.Write(P_string_newcode);
                    //Response.End();
                    p_int_newCode = Convert.ToInt32(P_string_newcode.Substring(12, 6)) + 1;
                    
                    P_string_newcode = DateTime.Now.ToString("yyyy-MM-dd") + "FM" + p_int_newCode.ToString();
                    txtfixCode.Text = P_string_newcode;
                }

            }
        
    }
    
    protected void Button1_Click(object sender, EventArgs e)
    {
       
       

        string sqlstr = "insert into fixManager (fixID,name,amount,factory,factorydate)values('"+txtfixCode.Text+"','"+name.Text + "','" + amount.Text + "','" + factory.Text + "','" + logoutdate.Text  + "')";
     // Response.Write(sqlstr);
      //  Response.End();

        if (bc.ExecSql(sqlstr))
        {
            Response.Write("<script language=javascript>alert('添加设备成功!');location='fix.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('添加失败,请重试!');</script>");
        }

    }
}

⌨️ 快捷键说明

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