示例#1
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
     _workers = db.GetWorkers();
     if (!IsPostBack)
     {
         DdlSklad1.DataSource = _workers;
         DdlSklad1.DataBind();
         DdlSklad1.SelectedIndex = 0;
     }
     using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("insert into Sklady (DataPost, NumDoc, NumSklada, Zakreplen, Name, NumID, TheNum, Price, Source, Ostatok, Obz) " +
                                         " values (@dp, @nd, @ns, @zk, @nm, @ni, @tn, @pr, @so, @os, @obz )", conn);
         cmd.Parameters.AddWithValue("dp", DateTime.Now);
         cmd.Parameters.AddWithValue("nd", TextBox1.Text);
         cmd.Parameters.AddWithValue("ns", SkladVvod.Text);
         cmd.Parameters.AddWithValue("zk", DdlSklad1.SelectedValue);
         cmd.Parameters.AddWithValue("nm", TextBox2.Text);
         cmd.Parameters.AddWithValue("ni", TextBox3.Text);
         cmd.Parameters.AddWithValue("tn", TextBox4.Text);
         cmd.Parameters.AddWithValue("pr", TextBox5.Text);
         cmd.Parameters.AddWithValue("so", TextBox6.Text);
         cmd.Parameters.AddWithValue("os", TextBox4.Text);
         cmd.Parameters.AddWithValue("obz", TextBox8.Text);
         cmd.ExecuteNonQuery();
         Sklsdd_Click(sender, e);
     }
     TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = "";
 }
示例#2
0
 protected void Vvod_Click(object sender, EventArgs e)
 {
     phVvod.Visible = true;
     SkladVvod.Text = DdlSklad.SelectedValue;
     App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
     _workers = db.GetWorkers();
     if (!IsPostBack)
     {
         DdlSklad1.DataSource = _workers;
         DdlSklad1.DataBind();
         DdlSklad1.SelectedIndex = 0;
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _role = CheckAccount();
     if (_role == "Worker")
     {
         phPost.Visible = false;
         if (!IsPostBack)
         {
             App_Code.Base db1  = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
             List <string> _wrk = new List <string>();
             _wrk = db1.GetIdUMbyName(User.Identity.Name);
             DdlSklad.DataSource = _wrk;
             DdlSklad.DataBind();
         }
         SkladVvod.Text = DdlSklad.SelectedValue;
         App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
         _workers = db.GetWorkers();
         if (!IsPostBack)
         {
             DdlSklad1.DataSource = _workers;
             DdlSklad1.DataBind();
             DdlSklad1.SelectedIndex = 0;
         }
     }
     else
     {
         if (!IsPostBack)
         {
             List <string> dt = new List <string>()
             {
                 "", "1/1", "1/2", "1/3", "1/4", "2/1", "2/2", "2/3", "2/4", "2/5", "4/1", "4/2", "все"
             };
             DdlSklad.DataSource = dt;
             DdlSklad.DataBind();
             SkladVvod.Text = DdlSklad.SelectedValue;
         }
         App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
         _workers = db.GetWorkers();
         if (!IsPostBack)
         {
             DdlSklad1.DataSource = _workers;
             DdlSklad1.DataBind();
             DdlSklad1.SelectedIndex = 0;
         }
     }
 }