Ejemplo n.º 1
0
        protected void gridBarCode_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            data = new dtHangHoa();
            ASPxGridView gridBarCode  = sender as ASPxGridView;
            object       IDHangHoa    = gridBarCode.GetMasterRowKeyValue();
            string       IDNguyenLieu = e.NewValues["IDNguyenLieu"].ToString();
            string       TrongLuong   = e.NewValues["TrongLuong"].ToString();
            string       MaNguyenLieu = dtThemHangHoa.LayMaNguyenLieu(IDNguyenLieu);
            string       NhaCungCap   = dtThemHangHoa.LayNhaCungCap(IDNguyenLieu);
            string       IDDonViTinh  = dtThemHangHoa.LayIDDonViTinh(IDNguyenLieu);
            DataTable    dt           = data.KT_NguyenLieu(IDHangHoa, IDNguyenLieu);

            if (dt.Rows.Count == 0)
            {
                data.ThemNguyenLieu(IDHangHoa, IDNguyenLieu, TrongLuong, MaNguyenLieu, NhaCungCap, IDDonViTinh);
            }
            else
            {
                throw new Exception("Lỗi: Nguyên liệu chế biến đã tồn tại?");
            }
            e.Cancel = true;
            gridBarCode.CancelEdit();
            gridBarCode.DataSource = data.GetListBarCode(IDHangHoa);
            gridBarCode.DataBind();
        }
Ejemplo n.º 2
0
        protected void gridBarCode_Init(object sender, EventArgs e)
        {
            data = new dtHangHoa();
            ASPxGridView gridBarCode = sender as ASPxGridView;
            object       IDHangHoa   = gridBarCode.GetMasterRowKeyValue();

            gridBarCode.DataSource = data.GetListBarCode(IDHangHoa);
            gridBarCode.DataBind();
        }
Ejemplo n.º 3
0
        protected void gridBarCode_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            data = new dtHangHoa();
            int ID = Int32.Parse(e.Keys["ID"].ToString());

            data.XoaNguyenLieu(ID);
            e.Cancel = true;
            ASPxGridView gridBarCode = sender as ASPxGridView;
            object       IDHangHoa   = gridBarCode.GetMasterRowKeyValue();

            gridBarCode.DataSource = data.GetListBarCode(IDHangHoa);
            gridBarCode.DataBind();
        }
Ejemplo n.º 4
0
        protected TokenCollection LoadListBarCode(object ID)
        {
            TokenCollection listBarCode = new TokenCollection();

            if (ID != null)
            {
                DataTable dt = data.GetListBarCode(ID);
                foreach (DataRow row in dt.Rows)
                {
                    listBarCode.Add(row["Barcode"].ToString());
                }
            }
            return(listBarCode);
        }