コード例 #1
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Delete Bảng
        /// </summary>
        public int Delete(Entities.NhaCungCap ncc1)
        {
            int Trave = 0;

            try
            {
                ncc = new Constants.NhaCungCap();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteNhaCungCap;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(ncc.HanhDong, SqlDbType.NVarChar, 20).Value = ncc1.HanhDong;
                cmd.Parameters.Add(ncc.NhaCungCapID, SqlDbType.Int).Value      = ncc1.NhaCungCapID;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
コード例 #2
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
        public bool UpdateDuNoNCC(Entities.NhaCungCap ncc1)
        {
            bool kt = false;

            try
            {
                Sql = new Constants.Sql();
                string sql = Sql.UpdateDuNoNCCC;
                conn = new Connection();
                ncc  = new Constants.NhaCungCap();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(ncc.MaNhaCungCap, SqlDbType.NVarChar, 20).Value = ncc1.MaNhaCungCap;
                cmd.Parameters.Add(ncc.DuNo, SqlDbType.Float).Value = ncc1.DuNo;
                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    kt = true;
                }
                else
                {
                    kt = false;
                }
                return(kt);
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); return(false); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
        }
コード例 #3
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public NhaCungCap()
 {
     ncc = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     nhacungcap = null;
     cn = null;
 }
コード例 #4
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public NhaCungCap()
 {
     ncc        = null;
     Sql        = null;
     conn       = null;
     cmd        = null;
     arr        = null;
     dr         = null;
     nhacungcap = null;
     cn         = null;
 }
コード例 #5
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.NhaCungCap[] Select()
        {
            Entities.NhaCungCap[] arrC = null;
            try
            {
                ncc = new Constants.NhaCungCap();
                Sql = new Constants.Sql();
                string sql = Sql.SelectNhaCungCapsAll;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    Entities.NhaCungCap nhacungcap = new Entities.NhaCungCap();
                    nhacungcap.NhaCungCapID  = Convert.ToInt32(dr[ncc.NhaCungCapID].ToString());
                    nhacungcap.MaNhaCungCap  = dr[ncc.MaNhaCungCap].ToString();
                    nhacungcap.TenNhaCungCap = dr[ncc.TenNhaCungCap].ToString();
                    nhacungcap.DiaChi        = dr[ncc.DiaChi].ToString();
                    nhacungcap.DienThoai     = dr[ncc.DienThoai].ToString();
                    nhacungcap.Email         = dr[ncc.Email].ToString();
                    nhacungcap.Fax           = dr[ncc.Fax].ToString();
                    nhacungcap.NguoiLienHe   = dr[ncc.NguoiLienHe].ToString();
                    nhacungcap.MST           = dr[ncc.MST].ToString();
                    nhacungcap.DuNo          = dr[ncc.DuNo].ToString();
                    nhacungcap.Website       = dr[ncc.Website].ToString();
                    nhacungcap.GhiChu        = dr[ncc.GhiChu].ToString();
                    nhacungcap.Deleted       = Convert.ToBoolean(dr[ncc.Deleted].ToString());
                    arr.Add(nhacungcap);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.NhaCungCap[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.NhaCungCap)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
コード例 #6
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Insert Update Bảng
        /// </summary>
        public int InsertUpdate(Entities.NhaCungCap ncc1)
        {
            int Trave = 0;

            try
            {
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateNhaCungCap;
                conn = new Connection();
                ncc  = new Constants.NhaCungCap();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(ncc.HanhDong, SqlDbType.NVarChar, 20).Value       = ncc1.HanhDong;
                cmd.Parameters.Add(ncc.NhaCungCapID, SqlDbType.Int).Value            = ncc1.NhaCungCapID;
                cmd.Parameters.Add(ncc.MaNhaCungCap, SqlDbType.NVarChar, 20).Value   = ncc1.MaNhaCungCap;
                cmd.Parameters.Add(ncc.TenNhaCungCap, SqlDbType.NVarChar, 200).Value = ncc1.TenNhaCungCap;
                cmd.Parameters.Add(ncc.DiaChi, SqlDbType.NVarChar, 200).Value        = ncc1.DiaChi;
                cmd.Parameters.Add(ncc.DienThoai, SqlDbType.NVarChar, 20).Value      = ncc1.DienThoai;
                cmd.Parameters.Add(ncc.Email, SqlDbType.NVarChar, 50).Value          = ncc1.Email;
                cmd.Parameters.Add(ncc.Fax, SqlDbType.NVarChar, 20).Value            = ncc1.Fax;
                cmd.Parameters.Add(ncc.NguoiLienHe, SqlDbType.NVarChar, 200).Value   = ncc1.NguoiLienHe;
                cmd.Parameters.Add(ncc.MST, SqlDbType.NVarChar, 20).Value            = ncc1.MST;
                cmd.Parameters.Add(ncc.DuNo, SqlDbType.Float).Value            = ncc1.DuNo;
                cmd.Parameters.Add(ncc.Website, SqlDbType.NVarChar, 200).Value = ncc1.Website;
                cmd.Parameters.Add(ncc.GhiChu, SqlDbType.NVarChar, 200).Value  = ncc1.GhiChu;
                cmd.Parameters.Add(ncc.Deleted, SqlDbType.Bit).Value           = ncc1.Deleted;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
コード例 #7
0
ファイル: NhaCungCap.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.NhaCungCap[] Select(string Cot, string Kieu, string Giatri)
        {
            Entities.NhaCungCap[] arrC = null;
            try
            {
                ncc = new Constants.NhaCungCap();
                Sql = new Constants.Sql();
                string sql = "";
                if (Kieu == "like")
                    sql = "select * from NhaCungCap where " + Cot + " " + Kieu + " '%" + Giatri + "%'";
                else
                    sql = "select * from NhaCungCap where " + Cot + " " + Kieu + " '" + Giatri + "'";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    Entities.NhaCungCap nhacungcap = new Entities.NhaCungCap();
                    nhacungcap.NhaCungCapID = Convert.ToInt32(dr[ncc.NhaCungCapID].ToString());
                    nhacungcap.MaNhaCungCap = dr[ncc.MaNhaCungCap].ToString();
                    nhacungcap.TenNhaCungCap = dr[ncc.TenNhaCungCap].ToString();
                    nhacungcap.DiaChi = dr[ncc.DiaChi].ToString();
                    nhacungcap.DienThoai = dr[ncc.DienThoai].ToString();
                    nhacungcap.Email = dr[ncc.Email].ToString();
                    nhacungcap.Fax = dr[ncc.Fax].ToString();
                    nhacungcap.NguoiLienHe = dr[ncc.NguoiLienHe].ToString();
                    nhacungcap.MST = dr[ncc.MST].ToString();
                    nhacungcap.DuNo = dr[ncc.DuNo].ToString();
                    nhacungcap.Website = dr[ncc.Website].ToString();
                    nhacungcap.GhiChu = dr[ncc.GhiChu].ToString();
                    nhacungcap.Deleted = Convert.ToBoolean(dr[ncc.Deleted].ToString());
                    arr.Add(nhacungcap);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.NhaCungCap[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.NhaCungCap)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
コード例 #8
0
        public frmBaoCaorpt(string hanhDong)
        {
            try
            {
                InitializeComponent();
                switch (hanhDong)
                {
                    case "Test":
                        {
                            Entities.KhachHang[] kh1 = new Entities.KhachHang[0];
                            GUI.Report.rptBCCongNoKhachHang report = new GUI.Report.rptBCCongNoKhachHang();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Khách Hàng");
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "KhachHang":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.KhachHang kh = new Entities.KhachHang("Select");
                            Entities.KhachHang[] kh1 = new Entities.KhachHang[1];
                            clientstrem = cl.SerializeObj(this.client1, "KhachHang", kh);
                            kh1 = (Entities.KhachHang[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCCongNoKhachHang report = new GUI.Report.rptBCCongNoKhachHang();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Khách Hàng");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "ChiTietHangHoa":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.rptBCChiTietHangHoa kh = new Entities.rptBCChiTietHangHoa("Select");
                            Entities.rptBCChiTietHangHoa[] kh1 = new Entities.rptBCChiTietHangHoa[1];
                            clientstrem = cl.SerializeObj(this.client1, "BCChiTietHangHoa", kh);
                            kh1 = (Entities.rptBCChiTietHangHoa[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCChiTietHangHoa report = new GUI.Report.rptBCChiTietHangHoa();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Chi Tiết Hàng Hóa");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "NCC":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.NhaCungCap kh = new Entities.NhaCungCap("Select");
                            Entities.NhaCungCap[] kh1 = new Entities.NhaCungCap[1];
                            clientstrem = cl.SerializeObj(this.client1, "NhaCungCap", kh);
                            kh1 = (Entities.NhaCungCap[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCCongNoNCC report = new GUI.Report.rptBCCongNoNCC();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Nhà Cung Cấp");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }

                    default: break;
                }
            }
            catch
            {
            }
        }