예제 #1
0
        /// <summary>
        /// hungvv =======================giao tiep voi server===========================
        /// </summary>
        private void SelectData(string MaKiemKe)
        {
            Entities.ChiTietKiemKeKho ctkk = new Entities.ChiTietKiemKeKho();
            dgvInsertOrder.DataSource = null;
            cl          = new Server_Client.Client();
            this.client = cl.Connect(Luu.IP, Luu.Ports);
            ctkk        = new Entities.ChiTietKiemKeKho("Select", MaKiemKe);
            clientstrem = cl.SerializeObj(this.client, "ChiTietKiemKeKho", ctkk);
            Entities.ChiTietKiemKeKho[] ddh = null;
            ddh = (Entities.ChiTietKiemKeKho[])cl.DeserializeHepper(clientstrem, ddh);
            dgvInsertOrder.DataSource            = ddh;
            dgvInsertOrder.RowHeadersVisible     = false;
            dgvInsertOrder.Columns[1].Visible    = false;
            dgvInsertOrder.Columns[10].Visible   = false;
            dgvInsertOrder.Columns[11].Visible   = false;
            dgvInsertOrder.Columns[0].HeaderText = "STT";
            dgvInsertOrder.Columns[2].HeaderText = "Mã hàng";
            dgvInsertOrder.Columns[3].HeaderText = "Tên hàng";
            dgvInsertOrder.Columns[4].HeaderText = "Tồn sổ sách";
            dgvInsertOrder.Columns[5].HeaderText = "Tồn thực tế";
            dgvInsertOrder.Columns[6].HeaderText = "Chênh lệch";
            dgvInsertOrder.Columns[7].HeaderText = "Lý do điều chỉnh";
            dgvInsertOrder.Columns[8].HeaderText = "Giá vốn";
            dgvInsertOrder.Columns[9].HeaderText = "Giá chênh lệch";
            new Common.Utilities().CountDatagridview(dgvInsertOrder);
            dgvInsertOrder.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvInsertOrder.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;

            client.Close();
            clientstrem.Close();
        }
예제 #2
0
        /// <summary>
        /// add ban ghi --------------------------------hungvv-----------------------------
        /// </summary>
        /// <param name="dgv"></param>
        public Entities.ChiTietKiemKeKho[] LuuThongTinChiTietKiemKeKho(DataGridView dgv, string hanhdong, string makiemke, string ghichu)
        {
            ArrayList arr = new ArrayList();
            int       i   = dgv.RowCount;

            Entities.ChiTietKiemKeKho[] mangBanghi = null;
            if (i > 0)
            {
                for (int x = 0; x < i; x++)
                {
                    Entities.ChiTietKiemKeKho layra = new Entities.ChiTietKiemKeKho();
                    layra.Hanhdong      = hanhdong.ToString();
                    layra.MaPhieuKiemKe = makiemke.ToString();
                    layra.MaHangHoa     = dgv.Rows[x].Cells[1].Value.ToString();
                    layra.TonThucTe     = dgv.Rows[x].Cells[3].Value.ToString();
                    layra.TonSoSach     = dgv.Rows[x].Cells[4].Value.ToString();
                    layra.LyDo          = dgv.Rows[x].Cells[6].Value.ToString();
                    layra.GhiChu        = "" + ghichu;
                    layra.Deleted       = false;
                    arr.Add(layra);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                mangBanghi = new Entities.ChiTietKiemKeKho[n];
                for (int j = 0; j < n; j++)
                {
                    mangBanghi[j] = (Entities.ChiTietKiemKeKho)arr[j];
                }
            }
            else
            {
                mangBanghi = null;
                mangBanghi = null;
            }
            return(mangBanghi);
        }
예제 #3
0
 /// <summary>
 /// chi tiet kiem ke
 /// </summary>
 /// <param name="MaKiemKe"></param>
 private void SelectData(string MaKiemKe)
 {
     try
     {
         Entities.ChiTietKiemKeKho ctkk = new Entities.ChiTietKiemKeKho();
         dgvInsertOrder.DataSource = null;
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         ctkk = new Entities.ChiTietKiemKeKho("Select", MaKiemKe);
         clientstrem = cl.SerializeObj(this.client, "ChiTietKiemKeKho", ctkk);
         Entities.ChiTietKiemKeKho[] ddh = null;
         ddh = (Entities.ChiTietKiemKeKho[])cl.DeserializeHepper(clientstrem, ddh);
         client.Close();
         clientstrem.Close();
         if (ddh.Length > 0)
         {
             dgvInsertOrder.DataSource = ddh;
         }
         else
         {
             Entities.ChiTietKiemKeKho[] lay = new Entities.ChiTietKiemKeKho[0];
             dgvInsertOrder.DataSource = lay;
         }
         fixDatagridview();
     }
     catch (Exception ex)
     {
         string s = ex.Message; Entities.ChiTietKiemKeKho[] lay = new Entities.ChiTietKiemKeKho[0];
         dgvInsertOrder.DataSource = lay; fixDatagridview();
     }
 }
예제 #4
0
 /// <summary>
 /// add ban ghi --------------------------------hungvv-----------------------------
 /// </summary>
 /// <param name="dgv"></param>
 public Entities.ChiTietKiemKeKho[] LuuThongTinChiTietKiemKeKho(DataGridView dgv, string hanhdong, string makiemke, string ghichu)
 {
     Entities.ChiTietKiemKeKho[] mangBanghi = null;
     try
     {
         string maKho = cbxKhoban.SelectedValue.ToString().ToUpper();
         ArrayList arr = new ArrayList();
         int i = dgv.RowCount;
         if (i > 0)
         {
             for (int x = 0; x < i; x++)
             {
                 Entities.ChiTietKiemKeKho layra = new Entities.ChiTietKiemKeKho();
                 layra.MaKho = maKho.Trim().ToUpper();
                 layra.Hanhdong = hanhdong.ToString();
                 layra.MaPhieuKiemKe = makiemke.ToString();
                 layra.MaHangHoa = dgv.Rows[x].Cells[0].Value.ToString().ToUpper();
                 layra.TonSoSach = dgv.Rows[x].Cells[2].Value.ToString();
                 layra.TonThucTe = dgv.Rows[x].Cells[3].Value.ToString();
                 layra.LyDo = dgv.Rows[x].Cells[5].Value.ToString();
                 layra.GhiChu = "" + ghichu;
                 layra.Deleted = false;
                 arr.Add(layra);
             }
             int n = arr.Count;
             if (n == 0) { mangBanghi = null; }
             mangBanghi = new Entities.ChiTietKiemKeKho[n];
             for (int j = 0; j < n; j++)
             {
                 mangBanghi[j] = (Entities.ChiTietKiemKeKho)arr[j];
             }
         }
         else
         {
             mangBanghi = null;
         }
     }
     catch (Exception ex)
     { string s = ex.Message; mangBanghi = null; }
     return mangBanghi;
 }
예제 #5
0
        private void ThemchiTietKiemKeKho(NetworkStream clientStream)
        {
            Entities.ChiTietKiemKeKho[] kt = (Entities.ChiTietKiemKeKho[])formatter.Deserialize(clientStream);
            switch (kt[0].Hanhdong)
            {
                case "Insert":
                    {
                        // Them ct kiem ke kho
                        int trave = new BizLogic.ChiTietKiemKeKho().LuuLai(kt);
                        // cap nhat sl vao ct kho hang
                        if (kt != null && kt.Length > 0)
                        {
                            foreach (Entities.ChiTietKiemKeKho item in kt)
                            {
                                new BizLogic.ChiTietKhoHangTheoHoaHonNhap().CongSoLuong(item);
                            }
                        }
                        // cap nhat gia von

                        formatter.Serialize(clientStream, trave);
                        break;
                    }
                case "Update":
                    {
                        Entities.ChiTietKiemKeKho ct = new Entities.ChiTietKiemKeKho();
                        if (kt != null)
                            ct = kt[0];
                        // Delete Ct
                        new BizLogic.ChiTietKiemKeKho().Delete(ct.MaPhieuKiemKe);
                        // Them ct kiem ke kho
                        int trave = new BizLogic.ChiTietKiemKeKho().LuuLai(kt);
                        // cap nhat sl vao ct kho hang
                        if (kt != null && kt.Length > 0)
                        {
                            foreach (Entities.ChiTietKiemKeKho item in kt)
                            {
                                if (item.IsChange)
                                    new BizLogic.ChiTietKhoHangTheoHoaHonNhap().CongSoLuong(item);
                            }
                        }

                        formatter.Serialize(clientStream, trave);
                        break;
                    }
                default:
                    break;
            }
        }
예제 #6
0
 /// <summary>
 /// add ban ghi --------------------------------hungvv-----------------------------
 /// </summary>
 /// <param name="dgv"></param>
 public Entities.ChiTietKiemKeKho[] LuuThongTinChiTietKiemKeKho(DataGridView dgv, string hanhdong, string makiemke,string ghichu)
 {
     ArrayList arr = new ArrayList();
     int i = dgv.RowCount;
     Entities.ChiTietKiemKeKho[] mangBanghi = null;
     if (i > 0)
     {
         for (int x = 0; x < i; x++)
         {
             Entities.ChiTietKiemKeKho layra = new Entities.ChiTietKiemKeKho();
             layra.Hanhdong = hanhdong.ToString();
             layra.MaPhieuKiemKe = makiemke.ToString();
             layra.MaHangHoa = dgv.Rows[x].Cells[1].Value.ToString();
             layra.TonThucTe = dgv.Rows[x].Cells[3].Value.ToString();
             layra.TonSoSach = dgv.Rows[x].Cells[4].Value.ToString();
             layra.LyDo = dgv.Rows[x].Cells[6].Value.ToString();
             layra.GhiChu = ""+ghichu;
             layra.Deleted = false;
             arr.Add(layra);
         }
         int n = arr.Count;
         if (n == 0) { return null; }
         mangBanghi = new Entities.ChiTietKiemKeKho[n];
         for (int j = 0; j < n; j++)
         {
             mangBanghi[j] = (Entities.ChiTietKiemKeKho)arr[j];
         }
     }
     else
     {
         mangBanghi = null;
         mangBanghi = null;
     }
     return mangBanghi;
 }
예제 #7
0
        /// <summary>
        /// hungvv =======================giao tiep voi server===========================
        /// </summary>
        private void SelectData(string MaKiemKe)
        {
            Entities.ChiTietKiemKeKho ctkk = new Entities.ChiTietKiemKeKho();
            dgvInsertOrder.DataSource = null;
            cl = new Server_Client.Client();
            this.client = cl.Connect(Luu.IP, Luu.Ports);
            ctkk = new Entities.ChiTietKiemKeKho("Select", MaKiemKe);
            clientstrem = cl.SerializeObj(this.client, "ChiTietKiemKeKho", ctkk);
            Entities.ChiTietKiemKeKho[] ddh =null;
            ddh = (Entities.ChiTietKiemKeKho[])cl.DeserializeHepper(clientstrem, ddh);
            dgvInsertOrder.DataSource = ddh;
            dgvInsertOrder.RowHeadersVisible = false;
            dgvInsertOrder.Columns[1].Visible = false;
            dgvInsertOrder.Columns[10].Visible = false;
            dgvInsertOrder.Columns[11].Visible = false;
            dgvInsertOrder.Columns[0].HeaderText = "STT";
            dgvInsertOrder.Columns[2].HeaderText = "Mã hàng";
            dgvInsertOrder.Columns[3].HeaderText = "Tên hàng";
            dgvInsertOrder.Columns[4].HeaderText = "Tồn sổ sách";
            dgvInsertOrder.Columns[5].HeaderText = "Tồn thực tế";
            dgvInsertOrder.Columns[6].HeaderText = "Chênh lệch";
            dgvInsertOrder.Columns[7].HeaderText = "Lý do điều chỉnh";
            dgvInsertOrder.Columns[8].HeaderText = "Giá vốn";
            dgvInsertOrder.Columns[9].HeaderText = "Giá chênh lệch";
            new Common.Utilities().CountDatagridview(dgvInsertOrder);
            dgvInsertOrder.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvInsertOrder.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            client.Close();
            clientstrem.Close();
        }