Exemple #1
0
        public ThanhPham GetThanhPhamByNgayAndSTT(string Ngay, string STTChuyen_SanPham)
        {
            ThanhPham thanhPham = null;

            try
            {
                dt.Clear();
                string sql = "select * from ThanhPham where Ngay = '" + Ngay + "' and STTChuyen_SanPham = '" + STTChuyen_SanPham + "' and IsDeleted=0";
                dt = dbclass.TruyVan_TraVe_DataTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    thanhPham = new ThanhPham();
                    DataRow rowFirst = dt.Rows[0];
                    int     laoDong  = 0;
                    int.TryParse(rowFirst["LaoDongChuyen"].ToString(), out laoDong);
                    float nangSuatLaoDong = 0;
                    float.TryParse(rowFirst["NangXuatLaoDong"].ToString(), out nangSuatLaoDong);
                    thanhPham.LaoDongChuyen   = laoDong;
                    thanhPham.NangXuatLaoDong = nangSuatLaoDong;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(thanhPham);
        }
Exemple #2
0
        public int SuaThongTinOBJ(ThanhPham obj)
        {
            int kq = 0;

            try
            {
                string sql = "update ThanhPham set NangXuatLaoDong = '" + obj.NangXuatLaoDong + "', LaoDongChuyen ='" + obj.LaoDongChuyen + "' where Ngay ='" + obj.Ngay + "' and STTChuyen_SanPham ='" + obj.STTChuyen_SanPham + "'";
                kq = dbclass.TruyVan_XuLy(sql);

                return(kq);
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi: Không thể thay đổi thông tin thành phẩm của chuyền dưới CSDL", "Lỗi truy vấn CSDL", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(kq);
            }
        }
Exemple #3
0
        public int ThemOBJ(ThanhPham obj)
        {
            int kq = 0;

            try
            {
                string sql = "insert into ThanhPham(Ngay, STTChuyen_SanPham, NangXuatLaoDong, LaoDongChuyen) values('" + obj.Ngay + "','" + obj.STTChuyen_SanPham + "','" + obj.NangXuatLaoDong + "','" + obj.LaoDongChuyen + "')";
                kq = dbclass.TruyVan_XuLy(sql);

                return(kq);
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi: Không thể lưu thông tin thành phẩm của chuyền vào CSDL", "Lỗi truy vấn CSDL", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(kq);
            }
        }
Exemple #4
0
        public ThanhPham GetTPByWorkDayOld(string STTChuyen_SanPham)
        {
            ThanhPham thanhPham = null;

            try
            {
                dt.Clear();
                string sql = "select * from ThanhPham where STTChuyen_SanPham = '" + STTChuyen_SanPham + "' and IsDeleted=0 Order by  Ngay desc";
                dt = dbclass.TruyVan_TraVe_DataTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    thanhPham = new ThanhPham();
                    DataRow rowFirst = dt.Rows[0];
                    int     laoDong  = 0;
                    int.TryParse(rowFirst["LaoDongChuyen"].ToString(), out laoDong);
                    thanhPham.LaoDongChuyen = laoDong;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(thanhPham);
        }