Пример #1
0
        public void SelectData()
        {
            try
            {
                cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                Entities.ChiTietKhachHangTraLai[] ctk = new Entities.ChiTietKhachHangTraLai[1];
                ctk[0] = new Entities.ChiTietKhachHangTraLai("Select");
                clientstrem = cl.SerializeHepper(this.client1, "ChiTietKhachHangTraLai", ctk);
                ctk = (Entities.ChiTietKhachHangTraLai[])cl.DeserializeHepper(clientstrem, ctk);
                dgvXemthongtin.DataSource = ctk;

            }
            catch
            {
            }
        }
Пример #2
0
        /// <summary>
        /// hungvv ==================================================
        /// </summary>
        private void SelectChiTietKhachHangTraLai(string hanhdong)
        {
            Entities.DonDatHang pt = new Entities.DonDatHang();
            pt = new Entities.DonDatHang(hanhdong);
            Entities.ChiTietKhachHangTraLai[] pt1 = new Entities.ChiTietKhachHangTraLai[10];
            clientstrem = cl.SerializeObj(this.client, "ChiTietKhachHangTraLai", pt);

            Binding((Entities.ChiTietKhachHangTraLai[])cl.DeserializeHepper(clientstrem, pt1));
        }
Пример #3
0
 /// <summary>
 /// add ban ghi --------------------------------hungvv-----------------------------
 /// </summary>
 /// <param name="dgv"></param>
 public Entities.ChiTietKhachHangTraLai[] LuuChiTietKhachHangTraLai(DataGridView dgv, string hanhdong, string madondathang)
 {
     ArrayList arr = new ArrayList();
     int i = dgv.RowCount;
     Entities.ChiTietKhachHangTraLai[] mangBanghi = null;
     if (i > 0)
     {
         for (int x = 0; x < i; x++)
         {
             Entities.ChiTietKhachHangTraLai banghi = new Entities.ChiTietKhachHangTraLai();
             banghi.Hanhdong = hanhdong;
             banghi.MaKhachHangTraLai = madondathang.ToUpper();
             banghi.MaHangHoa = dgv.Rows[x].Cells[0].Value.ToString();
             banghi.SoLuong = System.Convert.ToInt32(dgv.Rows[x].Cells[2].Value.ToString());
             banghi.PhanTramChietKhau = dgv.Rows[x].Cells[4].Value.ToString();
             banghi.GhiChu = dgv.Rows[x].Cells[1].Value.ToString();
             banghi.Deleted = false;
             arr.Add(banghi);
         }
         int n = arr.Count;
         if (n == 0) { return null; }
         mangBanghi = new Entities.ChiTietKhachHangTraLai[n];
         for (int j = 0; j < n; j++)
         {
             mangBanghi[j] = (Entities.ChiTietKhachHangTraLai)arr[j];
         }
     }
     else
     {
         mangBanghi = null;
         mangBanghi = null;
     }
     return mangBanghi;
 }
Пример #4
0
        public Entities.ChiTietKhachHangTraLai[] LayCTKHTL_TheoMaPhieu(string MaPhieu)
        {
            try
            {

                if (CTKHTL.Length == 0)
                {
                    return new Entities.ChiTietKhachHangTraLai[0];
                }
                else
                {
                    int count = 0;
                    for (int i = 0; i < CTKHTL.Length; i++)
                    {
                        if (CTKHTL[i].MaKhachHangTraLai == MaPhieu)
                        {
                            count++;
                        }
                    }
                    Entities.ChiTietKhachHangTraLai[] CTKHTL1 = new Entities.ChiTietKhachHangTraLai[count];
                    count = 0;
                    for (int i = 0; i < CTKHTL.Length; i++)
                    {
                        if (CTKHTL[i].MaKhachHangTraLai == MaPhieu)
                        {
                            CTKHTL1[count] = CTKHTL[i];
                            count++;
                        }
                    }

                    if (CTKHTL1.Length == 0)
                    {

                        return new Entities.ChiTietKhachHangTraLai[0];
                    }

                    return CTKHTL1;
                }
            }
            catch
            {
                return new Entities.ChiTietKhachHangTraLai[0];
            }
        }
Пример #5
0
        public void LayCTKHTL()
        {
            try
            {
                Entities.ChiTietKhachHangTraLai[] HDN = new Entities.ChiTietKhachHangTraLai[0];
                HDN = new BizLogic.ChiTietKhachHangTraLai().Select();
                if (HDN == null)
                {
                    CTKHTL = new Entities.ChiTietKhachHangTraLai[0];
                    return;
                }

                CTKHTL = HDN;
            }
            catch
            {
            }
        }
Пример #6
0
        public Entities.ChiTietKhachHangTraLai[] LuuChiTietKhachHangTraLai(DataGridView dgv, string hanhdong, string madondathang, string makho)
        {
            Entities.ChiTietKhachHangTraLai[] mangBanghi = null;
            try
            {
                ArrayList arr = new ArrayList();
                int i = dgv.RowCount;

                if (i > 0)
                {
                    for (int x = 0; x < i; x++)
                    {
                        Entities.ChiTietKhachHangTraLai banghi = new Entities.ChiTietKhachHangTraLai();
                        banghi.Hanhdong = hanhdong;
                        banghi.MaKhachHangTraLai = madondathang;
                        banghi.MaHangHoa = dgv.Rows[x].Cells[0].Value.ToString().ToUpper();
                        banghi.TenHangHoa = dgv.Rows[x].Cells["TenHangHoa"].Value.ToString();
                        banghi.SoLuong = System.Convert.ToInt32(dgv.Rows[x].Cells[2].Value.ToString());
                        banghi.PhanTramChietKhau = dgv.Rows[x].Cells[4].Value.ToString();
                        banghi.DonGia = dgv.Rows[x].Cells["Giaban"].Value.ToString();
                        banghi.Thue = dgv.Rows[x].Cells["Thuegiatrigiatang"].Value.ToString();
                        banghi.GhiChu = txtDiengiai.Text;
                        banghi.Deleted = false;
                        banghi.Makho = makho;
                        arr.Add(banghi);
                    }
                    int n = arr.Count;
                    if (n == 0) { return null; }
                    mangBanghi = new Entities.ChiTietKhachHangTraLai[n];
                    for (int j = 0; j < n; j++)
                    {
                        mangBanghi[j] = (Entities.ChiTietKhachHangTraLai)arr[j];
                    }
                }
                else
                {
                    mangBanghi = null;
                }
            }
            catch (Exception ex)
            { string s = ex.Message; mangBanghi = null; }
            return mangBanghi;
        }
        public Entities.BCNhapHangTheoNhomHang Select()
        {
            Entities.BCNhapHangTheoNhomHang list = null;
            try
            {
                list = new Entities.BCNhapHangTheoNhomHang();

                ////Lấy hóa đơn nhập
                //con = new Connection();
                //cn = con.openConnection();
                //List<Entities.HoaDonNhap> HoaDonNhap = new List<Entities.HoaDonNhap>();
                //cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                //cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "HoaDonNhap";
                //dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                //while (dr.Read())
                //{
                //    Entities.HoaDonNhap row = new Entities.HoaDonNhap();
                //    row.MaHoaDonNhap = dr["MaHoaDonNhap"].ToString();
                //    row.NgayNhap = DateTime.Parse(dr["NgayNhap"].ToString());
                //    HoaDonNhap.Add(row);
                //}
                //list.HoaDonNhap = HoaDonNhap;
                //cmd.Connection.Dispose();
                //cn.Close();
                //con.closeConnection();

                //Lấy chi tiết hóa đơn nhập
                con = new Connection();
                cn = con.openConnection();
                List<Entities.ChiTietHoaDonNhap> ChiTietHoaDonNhap = new List<Entities.ChiTietHoaDonNhap>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "ChiTietHoaDonNhap";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.ChiTietHoaDonNhap row = new Entities.ChiTietHoaDonNhap();
                    row.MaHoaDonNhap = dr["MaHoaDonNhap"].ToString();
                    row.MaHangHoa = dr["MaHangHoa"].ToString();
                    row.SoLuong = int.Parse(dr["SoLuong"].ToString());
                    row.NgayNhap = DateTime.Parse(dr["NgayNhap"].ToString());
                    ChiTietHoaDonNhap.Add(row);
                }
                list.ChiTietHoaDonNhap = ChiTietHoaDonNhap;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

                ////Lấy khách hàng trả lại
                //con = new Connection();
                //cn = con.openConnection();
                //List<Entities.KhachHangTraLai> KhachHangTraLai = new List<Entities.KhachHangTraLai>();
                //cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                //cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "KhachHangTraLai";
                //dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                //while (dr.Read())
                //{
                //    Entities.KhachHangTraLai row = new Entities.KhachHangTraLai();
                //    row.MaKhachHangTraLai = dr["MaKhachHangTraLai"].ToString();
                //    row.NgayNhap = DateTime.Parse(dr["NgayNhap"].ToString());
                //    KhachHangTraLai.Add(row);
                //}
                //list.KhachHangTraLai = KhachHangTraLai;
                //cmd.Connection.Dispose();
                //cn.Close();
                //con.closeConnection();

                //Lấy chi tiết khách hàng trả lại
                con = new Connection();
                cn = con.openConnection();
                List<Entities.ChiTietKhachHangTraLai> ChiTietKhachHangTraLai = new List<Entities.ChiTietKhachHangTraLai>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "ChiTietKhachHangTraLai";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.ChiTietKhachHangTraLai row = new Entities.ChiTietKhachHangTraLai();
                    row.MaKhachHangTraLai = dr["MaKhachHangTraLai"].ToString();
                    row.MaHangHoa = dr["MaHangHoa"].ToString();
                    row.SoLuong = int.Parse(dr["SoLuong"].ToString());
                    row.NgayNhap = DateTime.Parse(dr["NgayNhap"].ToString());
                    ChiTietKhachHangTraLai.Add(row);
                }
                list.ChiTietKhachHangTraLai = ChiTietKhachHangTraLai;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

                //Lấy hàng hóa nhóm hàng
                con = new Connection();
                cn = con.openConnection();
                List<Entities.HangHoa> HangHoa = new List<Entities.HangHoa>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "HangHoaNhomHang";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.HangHoa row = new Entities.HangHoa();
                    row.MaHangHoa = dr["MaHangHoa"].ToString();
                    row.TenHangHoa = dr["TenHangHoa"].ToString();
                    row.MaNhomHangHoa = dr["MaNhomHang"].ToString();
                    row.TenNhomHangHoa = dr["TenNhomHang"].ToString();
                    HangHoa.Add(row);
                }
                list.HangHoa = HangHoa;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

                //Lấy nhóm hàng
                con = new Connection();
                cn = con.openConnection();
                List<Entities.NhomHang> NhomHang = new List<Entities.NhomHang>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "NhomHang";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.NhomHang row = new Entities.NhomHang();
                    row.MaNhomHang = dr["MaNhomHang"].ToString();
                    row.TenNhomHang = dr["TenNhomHang"].ToString();
                    NhomHang.Add(row);
                }
                list.NhomHang = NhomHang;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

                //Lấy gói hàng
                con = new Connection();
                cn = con.openConnection();
                List<Entities.GoiHang> GoiHang = new List<Entities.GoiHang>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "GoiHang";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.GoiHang row = new Entities.GoiHang();
                    row.MaGoiHang = dr["MaGoiHang"].ToString();
                    GoiHang.Add(row);
                }
                list.GoiHang = GoiHang;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

                //Lấy chi tiết gói hàng
                con = new Connection();
                cn = con.openConnection();
                List<Entities.ChiTietGoiHang> ChiTietGoiHang = new List<Entities.ChiTietGoiHang>();
                cmd = new SqlCommand("exec sp_BCNhapHangTheoNhomHangFIX @ThaoTac", cn);
                cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "ChiTietGoiHang";
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    Entities.ChiTietGoiHang row = new Entities.ChiTietGoiHang();
                    row.MaGoiHang = dr["MaGoiHang"].ToString();
                    row.MaHangHoa = dr["MaHangHoa"].ToString();
                    row.SoLuong = int.Parse(dr["SoLuong"].ToString());
                    ChiTietGoiHang.Add(row);
                }
                list.ChiTietGoiHang = ChiTietGoiHang;
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();

            }
            catch { return null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                con.closeConnection();
            }
            return list;
        }
Пример #8
0
        public void LayCTKHTL()
        {
            try
            {

                cl = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                Entities.CheckRefer ctxh = new Entities.CheckRefer("CTKHTL");
                clientstrem = cl.SerializeObj(this.client, "Select", ctxh);
                Entities.ChiTietKhachHangTraLai[] HDN = new Entities.ChiTietKhachHangTraLai[0];
                HDN = (Entities.ChiTietKhachHangTraLai[])cl.DeserializeHepper1(clientstrem, HDN);
                if (HDN == null)
                {
                    CTKHTL = new Entities.ChiTietKhachHangTraLai[0];
                    return;
                }

                CTKHTL = HDN;
            }
            catch
            {
            }
        }