public void ExecuteProcedure(string ProcedureName, List<SqlParameter> parameters) { //try //{ command.CommandText = ProcedureName; command.CommandType = CommandType.StoredProcedure; command.Parameters.Clear(); foreach (var param in parameters) { command.Parameters.Add(param); } if (connection.State == ConnectionState.Closed) connection.Open(); command.ExecuteNonQuery(); string tbname = ProcedureName.Replace("CAPNHAT", "").Replace("XOA", "").Replace("THEMVAO", ""); if (tbname != "CheckData"&&tbname!="PHIEUNHANPHONG") { BUS.BUSCheckData _checkdata = new BUS.BUSCheckData(); DTO.DTOCheckData _dtocd = _checkdata.LayTheoMaCheckData(tbname).First(); _dtocd.Version = _dtocd.Version + 1; _checkdata.CapnhatCheckData(_dtocd); } connection.Close(); //} //catch (Exception ex) //{ // System.Windows.Forms.MessageBox.Show("Lỗi: " + ex.ToString(), "Lỗi"); //} }
public static void CheckData() { BUS.BUSCheckData _ch = new BUS.BUSCheckData(); foreach (DTO.DTOCheckData _cd in _ch.LayTatCaCheckData()) { switch (_cd.Name) { case "BANGGIA": { Data.BANGIA = _cd.Version; }; break; case "CHIETKHAU": { Data.CHIETKHAU = _cd.Version; }; break; case "CHITIETDV": { Data.CHITIETDV = _cd.Version; }; break; case "CHITIETPDK": { Data.CHITIETPDK = _cd.Version; }; break; case "CHITIETTB": { Data.CHITIETTB = _cd.Version; }; break; case "CHUCVU": { Data.CHUCVU = _cd.Version; }; break; case "CTCHIETKHAU": { Data.CTCHIETKHAU = _cd.Version; }; break; case "CTPHUTHU": { Data.CTPHUTHU = _cd.Version; }; break; case "DICHVU": { Data.DICHVU = _cd.Version; }; break; case "HOADON": { Data.HOADON = _cd.Version; }; break; case "KHACHHANG": { Data.KHACHHANG = _cd.Version; }; break; case "KIEUPHONG": { Data.KIEUPHONG = _cd.Version; }; break; case "LOAIKH": { Data.LOAIKH = _cd.Version; }; break; case "LOAIPHONG": { Data.LOAIPHONG = _cd.Version; }; break; case "NHANVIEN": { Data.NHANVIEN = _cd.Version; }; break; case "PHIEUDK": { Data.PHIEUDK = _cd.Version; }; break; case "PHIEUNHANPHONG": { Data.PHIEUNHANPHONG = _cd.Version; }; break; case "PHONG": { Data.PHONG = _cd.Version; }; break; case "PHUTHU": { Data.PHUTHU = _cd.Version; }; break; case "THIETBI": { Data.THIETBI = _cd.Version; }; break; case "TINHTRANG": { Data.TINHTRANG = _cd.Version; }; break; case "tblGROUP": { Data.tblGROUP = _cd.Version; }; break; case "tblUSER": { Data.tblUSER = _cd.Version; }; break; case "tblGROUP_FUNCTION": { Data.tblGROUP_FUNCTION = _cd.Version; }; break; case "tblGROUPMODULE": { Data.tblGROUPMODULE = _cd.Version; }; break; case "tblGROUPUSER": { Data.tblGROUPUSER = _cd.Version; }; break; } } }