Ejemplo n.º 1
0
 protected void btnThemTC_Click(object sender, EventArgs e)
 {
     try
     {
         int maBM = int.Parse(hdfMaBM.Value);
         List <TieuChiTheoBieuMau> lsTieuChiTheoBM = new List <TieuChiTheoBieuMau>();
         foreach (ListViewDataItem i in lvDSTCTheoNTC.Items)
         {
             HiddenField hdf     = i.FindControl("hdfMaTC") as HiddenField;
             CheckBox    chk     = i.FindControl("chbTieuChi") as CheckBox;
             TextBox     trongSo = i.FindControl("txtTrongSo") as TextBox;
             if (chk.Checked)
             {
                 TieuChiTheoBieuMau tieuChiTheoBM = new TieuChiTheoBieuMau();
                 int maTC = int.Parse(hdf.Value);
                 tieuChiTheoBM.MaTC    = maTC;
                 tieuChiTheoBM.MaBM    = maBM;
                 tieuChiTheoBM.TrongSo = float.Parse(trongSo.Text);
                 lsTieuChiTheoBM.Add(tieuChiTheoBM);
             }
         }
         kho.ThemDCTCTheoBM(lsTieuChiTheoBM);
         kho.Luu();
         this.loadTieuChiToLV(maBM);
         this.loadNTC();
     }
     catch
     {
         lblLoiLuuTieuChi.Text = "Lỗi lưu Tiêu chí";
     }
 }
Ejemplo n.º 2
0
 public bool ThemTCTheoBM(TieuChiTheoBieuMau tctbm)
 {
     try
     {
         dc.TieuChiTheoBieuMaus.InsertOnSubmit(tctbm);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
    void TaoDuLieuTieuChiTheoBieuMau()
    {
        int  maBM      = 1;
        bool trangThai = true;

        using (DBDataContext dc = new DBDataContext(MyUtility.ChuoiKetNoi))
        {
            foreach (TieuChi tc in kho.DanhSachTieuChi)
            {
                TieuChiTheoBieuMau x = new TieuChiTheoBieuMau()
                {
                    MaBM    = maBM,
                    TrongSo = tc.TrongSo,
                    Chon    = trangThai,
                    MaTC    = tc.MaTC
                };
                dc.TieuChiTheoBieuMaus.InsertOnSubmit(x);
            }
            dc.SubmitChanges();
        }
    }