public int GetObjectNTKTByIDPO(string strIdPO, ref NTKT nTKT) { string strQueryOne = "select * from NTKT where id_po=" + "'" + strIdPO + "'"; DataSet ds = new DataSet(); int ret = OPMDBHandler.fQuerryData(strQueryOne, ref ds); if (0 != ds.Tables.Count) { nTKT.ID_NTKT = (string)ds.Tables[0].Rows[0].ItemArray[0]; nTKT.POID = (string)ds.Tables[0].Rows[0].ItemArray[1]; nTKT.NumberOfDevice = (int)ds.Tables[0].Rows[0].ItemArray[2]; nTKT.DateDuKienNTKT = ((DateTime)ds.Tables[0].Rows[0].ItemArray[3]).ToString("yyyy-MM-dd"); //nTKT.getCreateDate = ((DateTime)ds.Tables[0].Rows[0].ItemArray[5]).ToString("yyyy-MM-dd"); } else { return(0); } return(1); }
public int GetObjectNTKTGUI(string strIdNTKT, ref NTKT nTKT) { string strQueryOne = "SELECT t1.id,t1.id_po, t1.deliver_date_expected, t1.email_request_status, t2.po_number, t2.id_contract, t3.KHMS FROM NTKT t1 join PO t2 ON t1.id_po =t2.id join Contract t3 ON t2.id_Contract =t3.id where t1.id = " + "'" + strIdNTKT + "'"; DataSet ds = new DataSet(); int ret = OPMDBHandler.fQuerryData(strQueryOne, ref ds); if (0 != ds.Tables.Count) { nTKT.ID_NTKT = (string)ds.Tables[0].Rows[0].ItemArray[0]; nTKT.POID = (string)ds.Tables[0].Rows[0].ItemArray[1]; nTKT.DateDuKienNTKT = ((DateTime)ds.Tables[0].Rows[0].ItemArray[2]).ToString("yyyy-MM-dd"); nTKT.PONumber = (string)ds.Tables[0].Rows[0].ItemArray[4]; nTKT.IDContract = (string)ds.Tables[0].Rows[0].ItemArray[5]; nTKT.KHMS = (string)ds.Tables[0].Rows[0].ItemArray[6]; } else { return(0); } return(1); }
public int InsertNewNTKT(NTKT nTKT) { string strInsertNTKTNew = "insert into NTKT values ("; strInsertNTKTNew += "'"; strInsertNTKTNew += nTKT.ID_NTKT; strInsertNTKTNew += "',N'"; strInsertNTKTNew += nTKT.POID; strInsertNTKTNew += "','"; strInsertNTKTNew += nTKT.NumberOfDevice; strInsertNTKTNew += "','"; strInsertNTKTNew += nTKT.DateDuKienNTKT; strInsertNTKTNew += "','"; strInsertNTKTNew += "')"; int ret = OPMDBHandler.fInsertData(strInsertNTKTNew); if (0 == ret) { return(ret); } return(1); }