コード例 #1
0
 protected void Button4_Click(object sender, EventArgs e)
 {
     try
     {
         acceptance ac = new acceptance();
         ac.user_id   = Convert.ToInt32(TextBox1.ToString());
         ac.user_id   = Convert.ToInt32(usid.Value.ToString());
         ac.work_id   = mywork.id;
         ac.detail    = details.Value.ToString();
         ac.dead_time = Convert.ToDateTime(date.Value.ToString());
         DataClasses1DataContext db = new DataClasses1DataContext();
         var hj = from i in db.acceptances where i.user_id == ac.user_id && i.work_id == ac.work_id select i;
         if (hj.Count() > 0)
         {
             Exception c = new Exception("this user alredy accepted");
             throw c;
         }
         var maxValue = db.acceptances.Max(x => x.id);
         ac.id = maxValue + 1;
         db.acceptances.InsertOnSubmit(ac);
         db.SubmitChanges();
     }
     catch (Exception ex)
     {
         HtmlGenericControl er = (HtmlGenericControl)this.Master.FindControl("error");
         HtmlGenericControl al = (HtmlGenericControl)this.Master.FindControl("alert");
         al.Visible   = true;
         er.Visible   = true;
         er.InnerText = ex.Message;
     }
 }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["KitomaroConnectionString"].ConnectionString);
        SqlCommand    command;

        connection.Open();
        string str;

        if (Session["New"] != null)
        {
            TextBox1.Text += Session["New"].ToString();
            str            = "select * from UserData where Username='******'";
            command        = new SqlCommand(str, connection);
            SqlDataReader reader = command.ExecuteReader();
            if (reader.Read())
            {
                TextBox3.Text = reader["Gender"].ToString();
                TextBox2.Text = reader["Phonenumber"].ToString();
                TextBox4.Text = reader["Email"].ToString();
                reader.Close();
            }
        }
        else
        {
            Response.Redirect("UserrLogin.aspx");
        }
    }
コード例 #3
0
ファイル: search_page.aspx.cs プロジェクト: tinavas/Eathub
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a = TextBox1.ToString();

        Label1.Text = a;

        Response.Redirect("search_page.aspx");
    }
コード例 #4
0
 private void AddSomeone_Click(object sender, RoutedEventArgs e)
 {
     if (TextBox1.ToString() == String.Empty && listBox1.Items.Contains(TextBox1.Text))
     {
         MessageBox.Show("You enter an invalid name, or this name is already entered");
     }
     else
     {
         listBox1.Items.Add(TextBox1.Text);
     }
 }
コード例 #5
0
ファイル: WebForm14.aspx.cs プロジェクト: Osama-Daja/Web-Form
        protected void Button1_Click(object sender, EventArgs e)
        {
            StudentsDataSet.TBLStudentsDataTable tBLStudents = new StudentsDataSet.TBLStudentsDataTable();
            tBLStudents = (StudentsDataSet.TBLStudentsDataTable)Session["DATASET"];

            if (string.IsNullOrEmpty(TextBox1.Text))
            {
                GridView1.DataSource = from Student in tBLStudents
                                       select new
                { Student.ID, Student.Name, Student.Gender, Student.TotalMarks };
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = from Student in tBLStudents
                                       where Student.Name.ToUpper().StartsWith(TextBox1.ToString())
                                       select new
                { Student.ID, Student.Name, Student.Gender, Student.TotalMarks };
                GridView1.DataBind();
            }
        }
コード例 #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection sc = new SqlConnection(@"Data Source=DESKTOP-CKK6JR1;Initial Catalog=Tmu_login;Integrated Security=True");

            sc.Open();
            var            test           = DropDownList1.SelectedValue;
            var            test1          = TextBox1.ToString();
            var            test2          = TextBox2.ToString();
            string         selectedValue  = (this.DropDownList1.SelectedValue);
            string         selectedValue1 = (this.TextBox1.Text);
            string         selectedValue2 = (this.TextBox2.Text);
            SqlDataAdapter sd             = new SqlDataAdapter("select * from attendencestatus where emp_id =" + "'" + selectedValue + "'", sc);
            //
            DataSet ds = new DataSet();

            sd.Fill(ds, "attendencestatus");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            sc.Close();
            DropDownList1.DataTextField  = "emp_id";
            DropDownList1.DataValueField = "emp_id";
        }
コード例 #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string nums = TextBox1.ToString();
            string dev  = DropDownList3.ToString();

            SqlConnection myConnection = new SqlConnection(connectionString);

            myConnection.Open();
            string     selectcommand = "select 所属部门 from Admin where 用户名='" + Session["User"] + "'";
            SqlCommand myCommand     = new SqlCommand(selectcommand, myConnection);
            string     dep           = (string)myCommand.ExecuteScalar();

            selectcommand = "select 供货商 from Contract where 交易资产='" + dev + "'";
            string sup = (string)myCommand.ExecuteScalar();

            selectcommand = "select 是否耗材 from Contract where 交易资产='" + dev + "'";
            string hao = (string)myCommand.ExecuteScalar();

            selectcommand = "insert into Requirement (需求内容,需求数量,供货商,需求部门,是否耗材) values ('" +
                            dev + "','" + nums + "','" + sup + "','" + dep + "','" + hao + "'";


            myConnection.Close();
        }