Example #1
0
 private void frmBaoCaoNhap_Load(object sender, EventArgs e)
 {
     try
     {
         this.cbxThang.Items.AddRange(new object[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
         cbxThang.SelectedIndex = 0;
         this.cbxNam.Items.AddRange(new object[] { "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" });
         cbxNam.SelectedIndex = 0;
         thongtin = Congty("");
         switch (reportName)
         {
             //=============================================================================
             case "BaoCaoNhapTheoKhoHang":
                 {
                     Entities.HienThiBaoCao[] lay = new Entities.HienThiBaoCao[0];
                     dgvBaoCaoNhap.DataSource = lay;
                     fixDatagridview();
                     lblTieuDe.Text = "Báo Cáo Nhập Hàng Theo Kho Hàng Theo Kỳ";
                 } break;
             //=============================================================================
             case "BaoCaoNhapTheoNhomHang":
                 {
                     Entities.HienThiBaoCao[] lay = new Entities.HienThiBaoCao[0];
                     dgvBaoCaoNhap.DataSource = lay;
                     fixDatagridview();
                     lblTieuDe.Text = "Báo Cáo Nhập Hàng Theo Nhóm Hàng Theo Kỳ";
                 } break;
             //=============================================================================
             case "BaoCaoNhapTheoMatHang":
                 {
                     Entities.HienThiBaoCao[] lay = new Entities.HienThiBaoCao[0];
                     dgvBaoCaoNhap.DataSource = lay;
                     fixDatagridview();
                     lblTieuDe.Text = "Báo Cáo Nhập Hàng Theo Mat Hàng Theo Kỳ";
                 } break;
             //=============================================================================
             case "XuatNhapTonTheoNhomHang":
                 {
                     Entities.HienThiBaoCao[] g = new Entities.HienThiBaoCao[0];
                     dgvBaoCaoNhap.DataSource = g;
                     fixDatagridviewNhom();
                     lblTieuDe.Text = "Báo Cáo Xuất Nhập Tồn Hàng Theo Nhóm Hàng Theo Kỳ";
                 } break;
             default:
                 {
                     MessageBox.Show("Không có tên báo cáo.Ứng dụng sẽ đóng");
                     this.Close();
                 } break;
         }
         if (thongtin.TenCongTy == "")
         { MessageBox.Show("Thông tin công ty chưa có hãy kiểm tra lại"); return; }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
Example #2
0
        private void layBang()
        {
            layra = new Entities.ThongTinCongTy();
            Entities.TruyenGiaTri truyen = new Entities.TruyenGiaTri("Select", "");
            cl = new Server_Client.Client();
            this.client = cl.Connect(Luu.IP, Luu.Ports);
            clientstrem = cl.SerializeObj(this.client, "LayThongTinCongty", truyen);
            Entities.ThongTinCongTy[] thongtin = null;
            thongtin = (Entities.ThongTinCongTy[])cl.DeserializeHepper(clientstrem, thongtin);
            new Common.Utilities().BindingCombobox(thongtin, cbxCongty, "TenCongTy", "MaCongTy");

            for (int i = 0; i < thongtin.Length; i++)
            {
                if (thongtin[i].MaCongTy == cbxCongty.SelectedValue.ToString())
                {
                    layra.MaCongTy = thongtin[i].MaCongTy;
                    layra.TenCongTy = thongtin[i].TenCongTy;
                    layra.DiaChi = thongtin[i].DiaChi;
                    layra.SoDienThoai = thongtin[i].SoDienThoai;
                    layra.Fax = thongtin[i].Fax;
                    layra.Email = thongtin[i].Email;
                }
                else
                { continue; }
            }
        }
Example #3
0
 private void toolStripStatusLabel2_Click(object sender, EventArgs e)
 {
     try
     {
         if (Kiemtra())
         {
             ktgiatri = "a";
             Server_Client.Client cl = new Server_Client.Client();
             this.client1 = cl.Connect(Luu.IP, Luu.Ports);
             Entities.ThongTinCongTy nv;
             nv = new Entities.ThongTinCongTy("Update", int.Parse(id), txtmacongty.Text, txttencongty.Text, txtdiachi.Text, mktxtdienthoai.Text, txtemail.Text, txtwebsite.Text, txtfax.Text, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
             clientstrem = cl.SerializeObj(this.client1, "CongTy", nv);
             Entities.ThongTinCongTy msg = new Entities.ThongTinCongTy();
             msg = (Entities.ThongTinCongTy)cl.DeserializeHepper(clientstrem, msg);
             if (msg.MaCongTy == "YES")
             {
                 this.Close();
             }
             else
             {
                 // MessageBox.Show(msg.MaCongTy);
                 MessageBox.Show("Thất Bại");
                 txtmacongty.Text = new Common.Utilities().ProcessID(txtmacongty.Text);
             }
         }
     }
     catch { }
 }
Example #4
0
 /// <summary>
 /// thong tin cong ty
 /// </summary>
 /// <param name="maCongTy"></param>
 /// <returns></returns>
 private Entities.ThongTinCongTy Congty(string maCongTy)
 {
     Entities.ThongTinCongTy thongtin = null;
     try
     {
         Entities.TruyenGiaTri truyen = new Entities.TruyenGiaTri("Select", maCongTy);
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         clientstrem = cl.SerializeObj(this.client, "LayThongTinCongty", truyen);
         thongtin = (Entities.ThongTinCongTy)cl.DeserializeHepper(clientstrem, thongtin);
         client.Close();
         clientstrem.Close();
     }
     catch (Exception ex)
     { string s = ex.Message; thongtin = null; }
     return thongtin;
 }
Example #5
0
        private void toolStripStatusLabel1_Click(object sender, EventArgs e)
        {
            try
            {
                if (Kiemtra())
                {
                    ktgiatri = "a";
                    Server_Client.Client cl = new Server_Client.Client();
                    this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                    Entities.ThongTinCongTy nv;
                    nv = new Entities.ThongTinCongTy("Insert", 0, txtmacongty.Text, txttencongty.Text, txtdiachi.Text, mktxtdienthoai.Text, txtemail.Text, txtwebsite.Text, txtfax.Text, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                    clientstrem = cl.SerializeObj(this.client1, "CongTy", nv);
                    Entities.ThongTinCongTy msg = new Entities.ThongTinCongTy();
                    msg = (Entities.ThongTinCongTy)cl.DeserializeHepper(clientstrem, msg);
                    if (msg.MaCongTy=="YES")
                    {
                        frmQuanLyCongTy.trave = "A";
                        this.Close();

                    }

                }
            }
            catch { }
        }
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {

                i = 0;
                dgvcongty.RowHeadersVisible = false;
                cl = new Server_Client.Client();
                // gán TCPclient
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                Entities.ThongTinCongTy kh = new Entities.ThongTinCongTy();
                // truyền HanhDong
                kh = new Entities.ThongTinCongTy("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                kh1 = new Entities.ThongTinCongTy[1];
                clientstrem = cl.SerializeObj(this.client1, "CongTy", kh);
                // đổ mảng đối tượng vào daThongTinCongTytagripview
                kh1 = (Entities.ThongTinCongTy[])cl.DeserializeHepper1(clientstrem, kh1);
                if (kh1 == null)
                {

                    hienthi = new Entities.ThongTinCongTy[0];
                    dgvcongty.DataSource = new Entities.ThongTinCongTy[0];
                    toolStripStatusLabel1.Enabled = true;
                    return;
                }

                Entities.ThongTinCongTy[] pt2 = new Entities.ThongTinCongTy[kh1.Length];
                int sotang = 0;
                for (int j = 0; j < kh1.Length; j++)
                {

                            pt2[sotang] = kh1[j];
                            sotang++;
                }
                hienthi = new Entities.ThongTinCongTy[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = pt2[j];
                    }
                }
                else
                {
                    dgvcongty.DataSource = new Entities.ThongTinCongTy[0];

                    return;
                }
                dgvcongty.DataSource = hienthi;
                new Common.Utilities().CountDatagridview(dgvcongty);
                toolStripStatusLabel1.Enabled = false;
                dgvcongty.Rows[0].Selected = true;
            }
            finally
            {
                try
                {
                    for (int j = 1; j < dgvcongty.ColumnCount; j++)
                    {
                        dgvcongty.Columns[j].Visible = false;
                    }
                    dgvcongty.Columns[0].Visible = true;
                    dgvcongty.Columns["MaCongTy"].Visible = true;
                    dgvcongty.Columns["TenCongTy"].Visible = true;
                    dgvcongty.Columns["DiaChi"].Visible = true;
                    dgvcongty.Columns["SoDienThoai"].Visible = true;
                    dgvcongty.Columns["Email"].Visible = true;
                    dgvcongty.Columns["Website"].Visible = true;
                    dgvcongty.Columns["Fax"].Visible = true;
                    dgvcongty.Columns[0].HeaderText = "STT";
                    dgvcongty.Columns[1].Visible = false;
                    dgvcongty.Columns["MaCongTy"].HeaderText = "Mã Công Ty";
                    dgvcongty.Columns["TenCongTy"].HeaderText = "Tên Công Ty";
                    dgvcongty.Columns["DiaChi"].HeaderText = "Địa Chỉ";
                    dgvcongty.Columns["SoDienThoai"].HeaderText = "Điện Thoại";
                    dgvcongty.Columns["Email"].HeaderText = "Email";
                    dgvcongty.Columns["Website"].HeaderText = "Website";
                    dgvcongty.Columns["Fax"].HeaderText = "Fax";
                    dgvcongty.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                    dgvcongty.AllowUserToAddRows = false;
                    dgvcongty.AllowUserToDeleteRows = false;
                    dgvcongty.AllowUserToResizeRows = false;
                }
                catch { }
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="congty"></param>
 /// <param name="data"></param>
 /// <param name="theoKy"></param>
 /// <param name="maKho"></param>
 public frmBaoCaoNhapHang(string hanhDong, Entities.ThongTinCongTy congty, Entities.XuatNhapTonTheoNhomHangHoa[] nhomHang, string theoKy, string ma, string maNhanVien, string tenBaoCao, string tenNhom)
 {
     InitializeComponent();
     this.hanhDong = hanhDong;
     this.congty = congty;
     this.nhomHang = nhomHang;
     this.theoKy = theoKy;
     this.ma = ma;
     this.maNhanVien = maNhanVien;
     this.tenBaoCao = tenBaoCao;
     this.tenNhom = tenNhom;
 }
 public frmBaoCaoNhapHang(string hanhDong, Entities.ThongTinCongTy congty, Entities.BaoCaoNhapHangTheoNhom[] nhomhanghoa, string theoKy, string ma, string maNhanVien, string tenBaoCao, string tenHang)
 {
     InitializeComponent();
     this.hanhDong = hanhDong;
     this.congty = congty;
     this.nhomhanghoa = nhomhanghoa;
     this.theoKy = theoKy;
     this.ma = ma;
     this.maNhanVien = maNhanVien;
     this.tenBaoCao = tenBaoCao;
     this.tenHang = tenHang;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="congty"></param>
 /// <param name="data"></param>
 /// <param name="theoKy"></param>
 /// <param name="maKho"></param>
 public frmBaoCaoNhapHang(string hanhDong, Entities.ThongTinCongTy congty, Entities.NhapHangTheoKho[] data, string theoKy, string ma, string maNhanVien, string tenBaoCao)
 {
     InitializeComponent();
     this.hanhDong = hanhDong;
     this.congty = congty;
     this.data = data;
     this.theoKy = theoKy;
     this.ma = ma;
     this.maNhanVien = maNhanVien;
     this.tenBaoCao = tenBaoCao;
 }