예제 #1
0
        /// <summary>
        /// Adds the specified import.
        /// </summary>
        /// <param name="import">The import.</param>
        /// <returns></returns>
        public tbl_Import Add(tbl_Import import)
        {
            if (import.ID == Guid.Empty)
            {
                import.ID = Guid.NewGuid();
            }
            _dataContext.tbl_Import.AddObject(import);
            _dataContext.SaveChanges();

            return(import);
        }
예제 #2
0
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            Label      lbMa = (Label)GridView1.Rows[e.NewEditIndex].FindControl("lbMa");
            tbl_Import i    = db.tbl_Imports.SingleOrDefault(c => c.Import_ID == int.Parse(lbMa.Text));

            txtMa.Text          = i.Import_ID.ToString();
            txtNgay.Text        = i.Date.ToString();
            DropDownList1.Text  = i.Supplier_ID.ToString();
            GridView1.EditIndex = e.NewEditIndex;
            load();
            Label1.Text = "";
        }
예제 #3
0
        protected void btnSua_Click1(object sender, EventArgs e)
        {
            tbl_Import i = db.tbl_Imports.SingleOrDefault(c => c.Import_ID == int.Parse(txtMa.Text));

            i.Import_ID   = int.Parse(txtMa.Text);
            i.Date        = DateTime.Parse(txtNgay.Text);
            i.Supplier_ID = int.Parse(DropDownList1.Text);
            db.SubmitChanges();
            load();
            Label1.Text = "Sửa thành công.";
            rong();
            txtNgay.Focus();
        }
예제 #4
0
        protected void btnNhap_Click(object sender, EventArgs e)
        {
            tbl_Import i = new tbl_Import();

            i.Date        = DateTime.Parse(txtNgay.Text);
            i.Supplier_ID = int.Parse(DropDownList1.Text);
            db.tbl_Imports.InsertOnSubmit(i);
            db.SubmitChanges();
            load();
            Label1.Text = "Nhập thành công.";
            rong();
            txtNgay.Focus();
        }
예제 #5
0
 protected void btnXoa_Click1(object sender, EventArgs e)
 {
     if (Kiemtrama(txtMa.Text))
     {
         tbl_Import i = db.tbl_Imports.SingleOrDefault(c => c.Import_ID == int.Parse(txtMa.Text));
         db.tbl_Imports.DeleteOnSubmit(i);
         db.SubmitChanges();
         load();
         Label1.Text = "Xoá thành công.";
         rong();
         txtNgay.Focus();
     }
     else
     {
         Label1.Text = "Không thể xoá hoá đơn.";
     }
 }
예제 #6
0
 /// <summary>
 /// Updates the specified import.
 /// </summary>
 /// <param name="import">The import.</param>
 public void Update(tbl_Import import)
 {
     _dataContext.SaveChanges();
 }