コード例 #1
0
 /// <summary>
 /// lay bang cong ty
 /// </summary>
 /// <param name="ct"></param>
 /// <returns></returns>
 public Entities.ThongTinCongTy sp_ThongTinCongTy(TruyenGiaTri ct)
 {
     Entities.ThongTinCongTy banghi = new Entities.ThongTinCongTy();
     try
     {
         string sql = "exec sp_ThongTinCongTy @MaCongTy";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaCongTy", SqlDbType.VarChar, 20).Value = ct.Giatritruyen;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         ArrayList arr = new ArrayList();
         while (dr.Read())
         {
             banghi.MaCongTy    = dr[0].ToString();
             banghi.TenCongTy   = dr[1].ToString();
             banghi.DiaChi      = dr[2].ToString();
             banghi.SoDienThoai = dr[3].ToString();
             banghi.Email       = dr[4].ToString();
             banghi.Website     = dr[5].ToString();
             banghi.Fax         = dr[6].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); banghi = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(banghi);
 }
コード例 #2
0
        /// <summary>
        /// lay bang cong ty
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        public Entities.ThongTinCongTy sp_ThongTinCongTy(Entities.TruyenGiaTri ct)
        {
            Entities.ThongTinCongTy banghi = new Entities.ThongTinCongTy();
            try
            {
                string sql = "exec sp_ThongTinCongTy @MaCongTy";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add("MaCongTy", SqlDbType.VarChar, 20).Value = ct.Giatritruyen;
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                ArrayList arr = new ArrayList();
                while (dr.Read())
                {

                    banghi.MaCongTy = dr[0].ToString();
                    banghi.TenCongTy = dr[1].ToString();
                    banghi.DiaChi = dr[2].ToString();
                    banghi.SoDienThoai = dr[3].ToString();
                    banghi.Email = dr[4].ToString();
                    banghi.Website = dr[5].ToString();
                    banghi.Fax = dr[6].ToString();
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); banghi = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return banghi;
        }
コード例 #3
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public ThongTinCongTy()
 {
     conn   = null;
     cmd    = null;
     dr     = null;
     congty = null;
     cn     = null;
 }
コード例 #4
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public ThongTinCongTy()
 {
     conn = null;
     cmd = null;
     dr = null;
     congty = null;
     cn = null;
 }
コード例 #5
0
ファイル: CongTy.cs プロジェクト: mrk29vn/vna-accounting
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public CongTy()
 {
     ncc = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     nhacungcap = null;
     cn = null;
 }
コード例 #6
0
ファイル: CongTy.cs プロジェクト: Gack113/PTUDCSDL1-DOAN
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public CongTy()
 {
     ncc        = null;
     Sql        = null;
     conn       = null;
     cmd        = null;
     arr        = null;
     dr         = null;
     nhacungcap = null;
     cn         = null;
 }
コード例 #7
0
ファイル: CongTy.cs プロジェクト: Gack113/PTUDCSDL1-DOAN
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.ThongTinCongTy[] Select()
        {
            Entities.ThongTinCongTy[] arrC = null;
            try
            {
                ncc = new Constants.CongTy();
                Sql = new Constants.Sql();
                string sql = Sql.SelectCongTy;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    Entities.ThongTinCongTy nhacungcap = new Entities.ThongTinCongTy();
                    nhacungcap.CongTyID    = Convert.ToInt32(dr[ncc.CongTyID].ToString());
                    nhacungcap.MaCongTy    = dr[ncc.MaCongTy].ToString();
                    nhacungcap.TenCongTy   = dr[ncc.TenCongTy].ToString();
                    nhacungcap.DiaChi      = dr[ncc.DiaChi].ToString();
                    nhacungcap.SoDienThoai = dr[ncc.SoDienThoai].ToString();
                    nhacungcap.Email       = dr[ncc.Email].ToString();
                    nhacungcap.Website     = dr[ncc.Website].ToString();
                    nhacungcap.Fax         = dr[ncc.Fax].ToString();

                    arr.Add(nhacungcap);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.ThongTinCongTy[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.ThongTinCongTy)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
コード例 #8
0
ファイル: CongTy.cs プロジェクト: mrk29vn/vna-accounting
 /// <summary>
 /// Insert Update Bảng
 /// </summary>
 public Entities.ThongTinCongTy InsertUpdate(Entities.ThongTinCongTy ncc1)
 {
     Entities.ThongTinCongTy nhacungcap = null;
     try
     {
         Sql = new Constants.Sql();
         string sql = Sql.InsertUpdateCongTy;
         conn = new Connection();
         ncc = new Constants.CongTy();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(ncc.HanhDong, SqlDbType.NVarChar, 20).Value = ncc1.HanhDong;
         cmd.Parameters.Add(ncc.CongTyID, SqlDbType.Int).Value =ncc1.CongTyID;
         cmd.Parameters.Add(ncc.MaCongTy, SqlDbType.NVarChar, 20).Value =ncc1.MaCongTy;
         cmd.Parameters.Add(ncc.TenCongTy, SqlDbType.NVarChar, 200).Value =ncc1.TenCongTy;
         cmd.Parameters.Add(ncc.DiaChi, SqlDbType.NVarChar, 200).Value =ncc1. DiaChi;
         cmd.Parameters.Add(ncc.SoDienThoai, SqlDbType.NVarChar, 20).Value =ncc1.SoDienThoai;
         cmd.Parameters.Add(ncc.Email, SqlDbType.NVarChar, 50).Value =ncc1. Email;
         cmd.Parameters.Add(ncc.Website, SqlDbType.NVarChar, 50).Value = ncc1.Website;
         cmd.Parameters.Add(ncc.Fax, SqlDbType.NVarChar, 20).Value =ncc1.Fax;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             nhacungcap = new Entities.ThongTinCongTy();
             nhacungcap.MaCongTy = dr[0].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return nhacungcap;
 }
コード例 #9
0
ファイル: CongTy.cs プロジェクト: Gack113/PTUDCSDL1-DOAN
 /// <summary>
 /// Insert Update Bảng
 /// </summary>
 public Entities.ThongTinCongTy InsertUpdate(Entities.ThongTinCongTy ncc1)
 {
     Entities.ThongTinCongTy nhacungcap = null;
     try
     {
         Sql = new Constants.Sql();
         string sql = Sql.InsertUpdateCongTy;
         conn = new Connection();
         ncc  = new Constants.CongTy();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add(ncc.HanhDong, SqlDbType.NVarChar, 20).Value    = ncc1.HanhDong;
         cmd.Parameters.Add(ncc.CongTyID, SqlDbType.Int).Value             = ncc1.CongTyID;
         cmd.Parameters.Add(ncc.MaCongTy, SqlDbType.NVarChar, 20).Value    = ncc1.MaCongTy;
         cmd.Parameters.Add(ncc.TenCongTy, SqlDbType.NVarChar, 200).Value  = ncc1.TenCongTy;
         cmd.Parameters.Add(ncc.DiaChi, SqlDbType.NVarChar, 200).Value     = ncc1.DiaChi;
         cmd.Parameters.Add(ncc.SoDienThoai, SqlDbType.NVarChar, 20).Value = ncc1.SoDienThoai;
         cmd.Parameters.Add(ncc.Email, SqlDbType.NVarChar, 50).Value       = ncc1.Email;
         cmd.Parameters.Add(ncc.Website, SqlDbType.NVarChar, 50).Value     = ncc1.Website;
         cmd.Parameters.Add(ncc.Fax, SqlDbType.NVarChar, 20).Value         = ncc1.Fax;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             nhacungcap          = new Entities.ThongTinCongTy();
             nhacungcap.MaCongTy = dr[0].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(nhacungcap);
 }
コード例 #10
0
 private void frmBaoCaorpt_Load(object sender, EventArgs e)
 {
     try
     {
         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ị
         Entities.ThongTinCongTy[] CT1 = new Entities.ThongTinCongTy[1];
         clientstrem = cl.SerializeObj(this.client1, "CongTy", kh);
         // đổ mảng đối tượng vào daThongTinCongTytagripview
         CT1 = (Entities.ThongTinCongTy[])cl.DeserializeHepper(clientstrem, CT1);
         if (CT1 != null)
         {
             CT = CT1[0];
         }
     }
     catch { }
 }
コード例 #11
0
ファイル: CongTy.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.ThongTinCongTy[] Select()
        {
            Entities.ThongTinCongTy[] arrC = null;
            try
            {
                ncc = new Constants.CongTy();
                Sql = new Constants.Sql();
                string sql = Sql.SelectCongTy;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
            while (dr.Read())
            {
                Entities.ThongTinCongTy nhacungcap= new Entities.ThongTinCongTy();
                nhacungcap.CongTyID = Convert.ToInt32(dr[ncc.CongTyID].ToString());
                nhacungcap.MaCongTy = dr[ncc.MaCongTy].ToString();
                nhacungcap.TenCongTy = dr[ncc.TenCongTy].ToString();
                nhacungcap.DiaChi = dr[ncc.DiaChi].ToString();
                nhacungcap.SoDienThoai = dr[ncc.SoDienThoai].ToString();
                nhacungcap.Email = dr[ncc.Email].ToString();
                nhacungcap.Website = dr[ncc.Website].ToString();
                nhacungcap.Fax = dr[ncc.Fax].ToString();

                arr.Add(nhacungcap);
            }
            int n = arr.Count;
            if (n == 0) { return null; }
            arrC = new Entities.ThongTinCongTy[n];
            for (int i = 0; i < n; i++)
            {
                arrC[i] = (Entities.ThongTinCongTy)arr[i];
            }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
コード例 #12
0
        /// <summary>
        /// Lấy dữ liệu thông tin công ty
        /// </summary>
        /// <returns></returns>
        public ThongTinCongTy GetCongTy()
        {
            ThongTinCongTy retVal;
            try
            {
                cl = new Server_Client.Client();
                // gán TCPclient
                client = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                // truyền HanhDong
                ThongTinCongTy thongTinCongTy = new ThongTinCongTy("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                ThongTinCongTy[] arr = new ThongTinCongTy[1];
                clientstrem = cl.SerializeObj(client, "CongTy", thongTinCongTy);
                // đổ mảng đối tượng vào daThongTinCongTytagripview
                arr = (ThongTinCongTy[])cl.DeserializeHepper1(clientstrem, arr);
                retVal = arr[0];
            }
            catch (Exception)
            {
                retVal = null;
            }

            return retVal;
        }
コード例 #13
0
        private void IniForm()
        {
            try
            {
                _dsHangHoaGoiHang = GetHangHoaGoiHang();
                _dsQuyDoiDonViTinh = GetQuyDoiDonViTinh();
                _congTy = GetCongTy();
                _dsThongTinMaVachTheVip = getTheVip();
                _dsThongTinMaVachTheGiaTri = GetTheGiaTri();

                chkGenerateLabel.Checked = false;

                //Khởi tạo Cbb loại giấy
                cbxLoaigiay.Items.Clear();
                cbxLoaigiay.Items.AddRange(new object[] { "Loại A5", "Loại 110", "Loại A4" });
                cbxLoaigiay.SelectedIndex = 0;

                btnLoadImage.Visible = false;
                Bitmap temp = new Bitmap(1, 1);
                temp.SetPixel(0, 0, BackColor);
                barcode.Image = temp;
                cbEncodeType.SelectedIndex = 0;
                cbBarcodeAlign.SelectedIndex = 0;
                cbLabelLocation.SelectedIndex = 0;
                cbRotateFlip.DataSource = Enum.GetNames(typeof(RotateFlipType));
                int i = 0;
                foreach (object o in cbRotateFlip.Items)
                {
                    if (o.ToString().Trim().ToLower() == "rotatenoneflipnone")
                        break;
                    i++;
                }
                cbRotateFlip.SelectedIndex = i;
                btnBackColor.BackColor = b.BackColor;
                btnForeColor.BackColor = b.ForeColor;

                dgvHangHoa.DataSource = new List<ThongTinMaVach>().ToArray();
                FixDatagridview();
            }
            catch
            {
                if (dgvHangHoa.RowCount > 0) return;
                toolStripStatusLabel1.Enabled = false;
                checkBox1.Enabled = false;
            }
        }
コード例 #14
0
 /// <summary>
 /// Lay hang hoa trong datagridview
 /// </summary>
 /// <param name="view"></param>
 /// <param name="thongTinCongTy"> </param>
 /// <returns></returns>
 private Barcode[] GetProduct(DataGridView view, ThongTinCongTy thongTinCongTy)
 {
     List<Barcode> hangHoaList = new List<Barcode>();
     try
     {
         int count = 0;
         if (view != null)
             count = view.Rows.Count;
         for (int i = 0; i < count; i++)
         {
             if (view == null) continue;
             string maHangHoa = view["maHangHoa", i].Value.ToString();
             string tenHangHoa = view["TenHangHoa", i].Value.ToString();
             string dongiastr = view["GiaBanLe", i].Value.ToString();
             double dongia = double.Parse(string.IsNullOrEmpty(dongiastr) ? "0" : dongiastr);
             int soLuong = 0;
             if (view["GhiChu", i].Value != null)
                 soLuong = int.Parse(view["GhiChu", i].Value.ToString());
             for (int j = 0; j < soLuong; j++)
             {
                 Barcode item = new Barcode
                                       {
                                           TenSieuThi = thongTinCongTy.TenCongTy,
                                           TenHangHoa = rdoVisibleName.Checked ? tenHangHoa : string.Empty,
                                           MaHangHoa = maHangHoa,
                                           MaVach = ConvertToByte(CreateImg(maHangHoa)),
                                           DonGia = rdoVisibleName.Checked ? -1 : dongia
                                       };
                 hangHoaList.Add(item);
             }
         }
     }
     catch
     {
         return new List<Barcode>().ToArray();
     }
     return hangHoaList.ToArray();
 }
コード例 #15
0
        /// <summary>
        /// GetTheVip
        /// </summary>
        /// <param name="barCode"></param>
        /// <param name="thongTinCongTy"></param>
        /// <returns></returns>
        public MaVachThe[] GetTheVip(Barcode[] barCode, ThongTinCongTy thongTinCongTy)
        {
            List<MaVachThe> retVal;
            try
            {
                retVal = new List<MaVachThe>();
                cl = new Server_Client.Client();
                // gán TCPclient
                client = 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.TheVip kh = new Entities.TheVip("Select", txtmkh.Text);
                clientstrem = cl.SerializeObj(client, "LayTheVip", null);
                // đổ mảng đối tượng vào datagripview
                TheVip[] theVip = (TheVip[])cl.DeserializeHepper1(clientstrem, null);
                //
                foreach (Barcode code in barCode)
                {
                    foreach (TheVip item in theVip)
                    {
                        if (!code.MaHangHoa.Trim().ToUpper().Equals(item.MaThe.Trim().ToUpper())) continue;
                        MaVachThe maVachThe = new MaVachThe
                        {
                            TenCongTy = thongTinCongTy.TenCongTy + "\r\n" + thongTinCongTy.DiaChi,
                            TenThe = "Thẻ Vip",
                            MaKH = item.MaKhachHang,
                            TenKH = code.TenHangHoa,
                            NgayBatDau = new DateTime().ToShortDateString(),
                            NgayKetThuc = new DateTime().ToShortDateString(),
                            MaVach = code.MaVach,
                            MaThe = item.MaThe,
                            GiaTriThe = double.Parse(item.GiaTriThe)
                        };
                        retVal.Add(maVachThe);
                        break;
                    }
                }
            }
            catch (Exception)
            {
                retVal = null;
            }

            return retVal.ToArray();
        }
コード例 #16
0
        /// <summary>
        /// GetTheGT
        /// </summary>
        /// <param name="barCode"></param>
        /// <param name="congTy"></param>
        /// <returns></returns>
        public MaVachThe[] GetTheGt(Barcode[] barCode, ThongTinCongTy congTy)
        {
            List<MaVachThe> retVal = null;
            try
            {
                retVal = new List<MaVachThe>();
                cl = new Server_Client.Client();
                // gán TCPclient
                client = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                TheGiamGia pt = new TheGiamGia { HanhDong = "Select" };
                clientstrem = cl.SerializeObj(client, "TheGiamGia", pt);
                TheGiamGia[] tggArr = new TheGiamGia[1];
                // đổ mảng đối tượng vào datagripview
                tggArr = (TheGiamGia[])cl.DeserializeHepper1(clientstrem, tggArr);
                //
                foreach (Barcode code in barCode)
                {
                    foreach (TheGiamGia item in tggArr)
                    {
                        if (code.MaHangHoa.Trim().ToUpper().Equals(item.MaTheGiamGia.Trim().ToUpper()))
                        {
                            MaVachThe mavach = new MaVachThe
                            {
                                TenCongTy = congTy.TenCongTy + "\r\n" + congTy.DiaChi,
                                TenThe = "Thẻ Giá Trị",
                                MaKH = item.MaKhachHang,
                                TenKH = code.TenHangHoa,
                                NgayBatDau = item.NgayBatDau.ToShortDateString(),
                                NgayKetThuc = item.NgayKetThuc.ToShortDateString(),
                                MaVach = code.MaVach,
                                MaThe = item.MaTheGiamGia,
                                GiaTriThe = double.Parse(item.GiaTriThe)
                            };
                            retVal.Add(mavach);
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
                retVal = null;
            }

            return retVal.ToArray();
        }