Example #1
0
 public ThongTinMaVach()
 {
     conn   = null;
     cmd    = null;
     arr    = null;
     dr     = null;
     mavach = null;
     cn     = null;
 }
Example #2
0
 public ThongTinMaVach()
 {
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     mavach = null;
     cn = null;
 }
Example #3
0
        public Entities.ThongTinMaVach[] sp_LayBang_ThongTinMaVachTheVip()
        {
            Entities.ThongTinMaVach[] arrC = null;
            try
            {
                string sql = "exec sp_LayBang_ThongTinMaVachTheVip";
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    mavach            = new Entities.ThongTinMaVach();
                    mavach.ChonIn     = false;
                    mavach.MaHangHoa  = dr[0].ToString();   //TheVip.MaThe
                    mavach.TenHangHoa = dr[1].ToString();   //KhachHang.Ten
                    mavach.GiaNhap    = dr[2].ToString();   //TheVip.GiaTriThe
                    mavach.GiaBanBuon = dr[3].ToString();   //TheVip.GiaTriConLai
                    mavach.GiaBanLe   = dr[4].ToString();   //TheVip.GhiChu
                    mavach.GhiChu     = dr[5].ToString();   //TheVip.MaKhachHang
                    arr.Add(mavach);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    arrC = null;
                }
                arrC = new Entities.ThongTinMaVach[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.ThongTinMaVach)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); arrC = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
Example #4
0
        //Entities
        public Entities.ThongTinMaVach[] sp_LayBang_ThongTinMaVachHangHoa()
        {
            Entities.ThongTinMaVach[] arrC = null;
            try
            {
                string sql = "exec sp_LayBang_ThongTinMaVachHangHoa";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    mavach = new Entities.ThongTinMaVach();
                    mavach.ChonIn = false;
                    mavach.MaHangHoa = dr[0].ToString();
                    mavach.TenHangHoa = dr[1].ToString();
                    mavach.GiaNhap = dr[2].ToString();
                    mavach.GiaBanBuon = dr[3].ToString();
                    mavach.GiaBanLe = dr[4].ToString();
                    mavach.GhiChu = "";
                    arr.Add(mavach);
                }
                int n = arr.Count;
                if (n == 0) { arrC= null; }
                arrC = new Entities.ThongTinMaVach[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.ThongTinMaVach)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); arrC = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
        private ThongTinMaVach RowsData()
        {
            ThongTinMaVach r = new ThongTinMaVach();
            try
            {
                if (txtMaHangHoa.Text == string.Empty || txtMaHangHoa.Text == "F4 - Tra cứu")
                {
                    MessageBox.Show("Bạn phải nhập mã " + GetTenRdo() + "");
                    txtMaHangHoa.Focus();
                    return null;
                }
                if (txtTenHangHoa.Text == string.Empty)
                {
                    MessageBox.Show("Bạn phải nhập tên " + GetTenRdo() + "");
                    txtMaHangHoa.Text = "";
                    txtTenHangHoa.Text = "";
                    txtSoLuongIn.Text = "1";
                    txtMaHangHoa.Focus();
                    return null;
                }
                try
                {
                    if (int.Parse("0" + txtSoLuongIn.Text) <= 0)
                    {
                        MessageBox.Show("Số lượng in nhập không đúng");
                        txtSoLuongIn.Text = "1";
                        txtSoLuongIn.Focus();
                        return null;
                    }
                }
                catch
                {
                    MessageBox.Show("Số lượng in nhập không đúng");
                    txtSoLuongIn.Text = "1";
                    txtSoLuongIn.Focus();
                    return null;
                }

                r.MaHangHoa = txtMaHangHoa.Text;
                r.TenHangHoa = txtTenHangHoa.Text;
                r.GhiChu = txtSoLuongIn.Text;
                string[] temp = txtGia.Text.Split('#');
                if (temp.Length > 0)
                {
                    r.GiaNhap = temp[0];
                    r.GiaBanBuon = temp[1];
                    r.GiaBanLe = temp[2];
                }
            }
            catch (Exception)
            {
                r = null;
            }
            return r;
        }
 /// <summary>
 /// Lấy dữ liệu thẻ Vip
 /// </summary>
 /// <returns></returns>
 List<ThongTinMaVach> getTheVip()
 {
     cl = new Server_Client.Client();
     client = cl.Connect(Luu.IP, Luu.Ports);
     clientstrem = cl.SerializeObj(client, "THAOTAC_InMaVachTheVip", new ThongTinMaVach());
     ThongTinMaVach[] bientam = new ThongTinMaVach[1];
     //Tìm kiếm thẻ vip
     bientam = (ThongTinMaVach[])cl.DeserializeHepper(clientstrem, bientam);
     client.Close();
     clientstrem.Close();
     return bientam == null ? new List<ThongTinMaVach>() : bientam.ToList();
 }
        /// <summary>
        /// Lấy dữ liệu bảng hàng hóa và gói hàng (Chạy 1 lần để lấy dữ liệu và gán vào biến dùng chung)
        /// </summary>
        /// <returns></returns>
        List<ThongTinMaVach> GetHangHoaGoiHang()
        {
            List<ThongTinMaVach> dsThongTinMaVachs = new List<ThongTinMaVach>();
            try
            {
                //Lấy MaHangHoa,TenHangHoa,GiaNhap,GiaBanBuon,GiaBanLe,GhiChu từ bảng HÀNG HÓA
                cl = new Server_Client.Client();
                client = cl.Connect(Luu.IP, Luu.Ports);
                ThongTinMaVach row1 = new ThongTinMaVach("Select");
                clientstrem = cl.SerializeObj(client, "ThongTinMaVachHangHoa", row1);
                ThongTinMaVach[] dsHangHoa = new ThongTinMaVach[0];
                dsHangHoa = (ThongTinMaVach[])cl.DeserializeHepper(clientstrem, dsHangHoa);
                client.Close();
                clientstrem.Close();
                if (dsHangHoa != null)
                    dsThongTinMaVachs.AddRange(dsHangHoa);
            }
            catch { }

            try
            {
                //Lấy a.GoiHangID,a.MaKho,a.MaGoiHang,a.TenGoiHang,a.MaNhomHang,b.TenNhomHang,a.GiaNhap,a.GiaBanBuon,a.GiaBanLe,a.Deleted
                //FROM GoiHang a join NhomHang b on a.MaNhomHang=b.MaNhomHang  WHERE a.Deleted='False'
                cl = new Server_Client.Client();
                client = cl.Connect(Luu.IP, Luu.Ports);
                GoiHang goi = new GoiHang("Select");
                clientstrem = cl.SerializeObj(client, "GoiHang", goi);
                GoiHang[] goiHang = new GoiHang[0];
                goiHang = (GoiHang[])cl.DeserializeHepper1(clientstrem, goiHang);
                if (goiHang != null)
                {
                    foreach (GoiHang item in goiHang)
                    {
                        if (item.Deleted) continue;
                        ThongTinMaVach row = new ThongTinMaVach
                                                 {
                                                     MaHangHoa = item.MaGoiHang,
                                                     TenHangHoa = item.TenGoiHang,
                                                     GiaNhap = item.GiaNhap,
                                                     GiaBanBuon = item.GiaBanBuon,
                                                     GiaBanLe = item.GiaBanLe
                                                 };
                        dsThongTinMaVachs.Add(row);
                    }
                }
            }
            catch { }

            return dsThongTinMaVachs;
        }