コード例 #1
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            data = new dtKe();
            DataTable db = data.DanhSachKe_Temp_ALL(IDTemp.Value.ToString());

            if (db.Rows.Count > 0)
            {
                foreach (DataRow dr in db.Rows)
                {
                    string    IDHangHoa   = dr["IDHangHoa"].ToString();
                    string    IDKe        = dr["IDKe"].ToString();
                    string    MaHang      = dtHangHoa.LayMaHang(IDHangHoa);
                    string    IDDonViTinh = dtHangHoa.LayIDDonViTinh(IDHangHoa);
                    DataTable dt          = dtKe.KTHangTrongKe(IDHangHoa, cmbKe.Value.ToString());
                    if (dt.Rows.Count == 0)
                    {
                        data = new dtKe();
                        data.ThemHangVaoKe(IDHangHoa, IDKe, IDDonViTinh, MaHang);
                    }
                }
                data = new dtKe();
                data.XoaKe_IDke_Temp(IDTemp.Value.ToString());
                Response.Redirect("DanhSachKe.aspx");
            }
            else
            {
                Response.Write("<script language='JavaScript'> alert('Danh sách hàng hóa trống.'); </script>");
            }
        }
コード例 #2
0
        private void Import_Temp(DataTable datatable)
        {
            int intRow = datatable.Rows.Count;

            if (datatable.Columns.Contains("MaHang") && datatable.Columns.Contains("TenHangHoa"))
            {
                string Temp = IDTemp.Value.ToString();
                if (intRow != 0)
                {
                    for (int i = 0; i <= intRow - 1; i++)
                    {
                        DataRow   dr        = datatable.Rows[i];
                        string    MaHang    = dr["MaHang"].ToString().Trim();
                        string    IDHangHoa = dtHangHoa.LayIDHangHoa_MaHang(MaHang.Trim());
                        string    IDKe      = cmbKe.Value.ToString();
                        DataTable db        = dtKe.KTHangTrongKe_Temp(IDHangHoa, IDKe, Temp);
                        if (db.Rows.Count == 0)
                        {
                            data = new dtKe();
                            data.ThemHangVaoKe_Temp(IDHangHoa, IDKe, Temp);
                            cmbHangHoa.Text = "";
                        }
                    }
                    LoadGrid(Temp);
                }
            }
            else
            {
                Response.Write("<script language='JavaScript'> alert('Dữ liệu không chính xác? Vui lòng kiểm tra lại.'); </script>");
            }
        }
コード例 #3
0
        protected void gridDanhSachHangHoa_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string ID = e.Keys[0].ToString();

            data = new dtKe();
            data.XoaKe_Temp(ID);
            e.Cancel = true;
            gridDanhSachHangHoa.CancelEdit();
            LoadGrid(IDTemp.Value.ToString());
        }
コード例 #4
0
        protected void gridKe_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string ID = e.Keys[0].ToString();

            data = new dtKe();
            data.XoaKe(ID);
            e.Cancel = true;
            gridKe.CancelEdit();
            LoadGrid(Session["IDKho"].ToString());
            dtLichSuTruyCap.ThemLichSu(Session["IDNhanVien"].ToString(), Session["IDNhom"].ToString(), "Danh sách kệ", Session["IDKho"].ToString(), "Danh mục", "Xóa");
        }
コード例 #5
0
        protected void gridChiTietHangHoa_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string ID = e.Keys[0].ToString();

            data = new dtKe();
            data.XoaChiTietKe(ID);
            e.Cancel = true;
            gridChiTietHangHoa.CancelEdit();
            LoadGrid(Request.QueryString["IDKe"].ToString());

            dtLichSuTruyCap.ThemLichSu(Session["IDNhanVien"].ToString(), Session["IDNhom"].ToString(), "Chi tiết hàng trong kệ", Session["IDKho"].ToString(), "Nhập xuất tồn", "Xóa");
        }
コード例 #6
0
        protected void gridKe_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            data = new dtKe();
            string TenKe = e.NewValues["TenKe"].ToString();
            string ViTri = e.NewValues["ViTri"].ToString();
            string MoTa  = e.NewValues["MoTa"] == null ? "" : e.NewValues["MoTa"].ToString();

            data.ThemKe(TenKe, ViTri, MoTa, Session["IDKho"].ToString());
            e.Cancel = true;
            gridKe.CancelEdit();
            LoadGrid(Session["IDKho"].ToString());
            dtLichSuTruyCap.ThemLichSu(Session["IDNhanVien"].ToString(), Session["IDNhom"].ToString(), "Danh sách kệ", Session["IDKho"].ToString(), "Danh mục", "Thêm");
        }
コード例 #7
0
 protected void btnThem_Temp_Click(object sender, EventArgs e)
 {
     if (cmbKe.Text != "")
     {
         if (cmbHangHoa.Text != "" && UploadFileExcel.FileName.ToString() != "")
         {
             Response.Write("<script language='JavaScript'> alert('Vui lòng chỉ chọn 1 hình thức thêm hàng hóa.'); </script>");
             return;
         }
         else if (UploadFileExcel.FileName.ToString() != "")
         {
             Import();
         }
         else if (cmbHangHoa.Text != "")
         {
             string IDHangHoa = cmbHangHoa.Value.ToString();
             string IDKe      = cmbKe.Value.ToString();
             data = new dtKe();
             string    Temp = IDTemp.Value.ToString();
             DataTable db   = dtKe.KTHangTrongKe_Temp(IDHangHoa, IDKe, Temp);
             if (db.Rows.Count == 0)
             {
                 data.ThemHangVaoKe_Temp(IDHangHoa, IDKe, Temp);
             }
             else
             {
                 Response.Write("<script language='JavaScript'> alert('Hàng hóa đã tồn tại trong kệ này.'); </script>");
             }
             cmbHangHoa.Text = "";
             LoadGrid(Temp);
         }
         else
         {
             Response.Write("<script language='JavaScript'> alert('Vui lòng chọn hàng hóa.'); </script>");
             return;
         }
     }
     else
     {
         Response.Write("<script language='JavaScript'> alert('Vui lòng chọn kệ hàng.'); </script>");
         return;
     }
 }
コード例 #8
0
 protected void cmbKe_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbKe.Text != "")
     {
         // kiểm kho phải kiểm từng kệ.
         data = new dtKiemKho();
         data.XoaPhieuKiemKho_Temp_IDPhieuKiemKho(IDPhieuKiemKho_Temp.Value.ToString());
         Random ran = new Random();
         IDPhieuKiemKho_Temp.Value = ran.Next(100000, 999999).ToString();
         dtKe      k  = new dtKe();
         DataTable db = k.DanhSachChiTietKe(cmbKe.Value.ToString());
         if (db.Rows.Count > 0)
         {
             string IDPhieuKiemKho = IDPhieuKiemKho_Temp.Value.ToString();
             foreach (DataRow dr in db.Rows)
             {
                 string    IDHangHoa  = dr["IDHangHoa"].ToString();
                 string    MaHang     = dr["MaHang"].ToString();
                 string    IDonViTinh = dr["IDonViTinh"].ToString();
                 int       TonKho     = dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, Session["IDKho"].ToString());
                 int       ChechLech  = -TonKho;
                 DataTable dt         = data.KTChiTietPhieuKiemKho_Temp(IDHangHoa, IDPhieuKiemKho, cmbKe.Value.ToString());
                 if (dt.Rows.Count == 0)
                 {
                     data = new dtKiemKho();
                     data.ThemPhieuKiemKho_Temp(IDPhieuKiemKho, IDHangHoa, TonKho, ChechLech, MaHang, IDonViTinh, cmbKe.Value.ToString());
                 }
             }
             LoadGrid(IDPhieuKiemKho);
         }
         else
         {
             Response.Write("<script language='JavaScript'> alert('Kệ chưa có hàng hóa.'); </script>");
         }
     }
 }
コード例 #9
0
 protected void btnHuy_Click(object sender, EventArgs e)
 {
     data = new dtKe();
     data.XoaALL_Temp(IDTemp.Value.ToString());
     Response.Redirect("DanhSachKe.aspx");
 }
コード例 #10
0
 private void LoadGrid(string IDTemp)
 {
     data = new dtKe();
     gridDanhSachHangHoa.DataSource = data.DanhSachKe_Temp(IDTemp);
     gridDanhSachHangHoa.DataBind();
 }
コード例 #11
0
 private void LoadGrid(string p)
 {
     data = new dtKe();
     gridKe.DataSource = data.DanhSachKe(p);
     gridKe.DataBind();
 }
コード例 #12
0
 private void LoadGrid(string p)
 {
     data = new dtKe();
     gridChiTietHangHoa.DataSource = data.DanhSachChiTietKe(p);
     gridChiTietHangHoa.DataBind();
 }