public void UpdateDefect(string Comments, string LoginUser, int DefectID, String DefectName, TdTimestamp Date, String Status, String Cycle, String Description, String Project, String Tester, String TestcasesAssociated, String Module, String Assignedto, TdTimestamp sysdate, String filenames, String filesize, Byte Attachments, int histid, String environment, String Severity, String Projectname, String Rootcause) { TdConnection con = new TdConnection(strConnString); Teradata.Client.Provider.TdCommand cmdUpdateDefect = new Teradata.Client.Provider.TdCommand(@"Update coebatch.tbl_Defect set DefectName='" + DefectName + "' ,Status='" + Status + "',SCycle ='" + Cycle + "',Description='" + Description + "',Project='" + Project + "',Tester='" + Tester + "',TestcasesAssociated='" + TestcasesAssociated + "',Module='" + Module + "',AssignedTo='" + Assignedto + "',CloseDate='" + sysdate + "', Environment = '" + environment + "' , Severity = '" + Severity + "', Releases = '" + Projectname + "',Rootcause = '" + Rootcause + "' where DefectID= '" + DefectID + "'", con); Teradata.Client.Provider.TdCommand cmdInsertComments = new Teradata.Client.Provider.TdCommand(@"Insert into coebatch.tbl_Comments Values ('" + DefectID + "','" + Comments + "','" + sysdate + "', '" + LoginUser + "' )", con); DateTime Datetimestamp = DateTime.Now; Teradata.Client.Provider.TdCommand cmdUpdateDefectHistory = new Teradata.Client.Provider.TdCommand(@"Insert into coebatch.tbl_Defect_History Values('" + DefectID + "','" + DefectName + "' ,'" + Date + "','" + Status + "','" + Cycle + "','" + Description + "','" + Project + "','" + Tester + "','" + TestcasesAssociated + "','" + Module + "','" + Assignedto + "','" + sysdate + "','" + histid + "','" + LoginUser + "', '" + environment + "' , '" + Severity + "','" + Projectname + "','" + Rootcause + "') ", con); try { //Open the Connection to connect to the database con.Open(); //Execute the Query cmdUpdateDefect.ExecuteNonQuery(); cmdInsertComments.ExecuteNonQuery(); cmdUpdateDefectHistory.ExecuteNonQuery(); } catch (TdException ex) { throw ex; } finally { //Close the Connection from the Database con.Close(); } }
public int InsertLogin(string Loginuser, string Password) { TdConnection con = new TdConnection(strConnString); int id = 0; //Define the Command Object Teradata.Client.Provider.TdCommand cmdAddLogin = new Teradata.Client.Provider.TdCommand(@"INSERT INTO coebatch.tbl_Login Values('" + Loginuser + "','" + Password + "')", con); try { //Open the Connection to connect to the database con.Open(); //Execute the Query cmdAddLogin.ExecuteNonQuery(); id = 1; return(id); } catch (Teradata.Client.Provider.TdException ex) { throw ex; } finally { //Close the Connection from the Database con.Close(); } return(id); }
public void InsertDefect(string Loginuser, int DefectID, String DefectName, TdTimestamp Date, String Status, String Cycle, String Description, String Project, String Tester, String TestcasesAssociated, String Module, String Assignedto, TdTimestamp date1, String filenames, String filesize, Byte Attachments, String environment, String severity, String Projectname, String Rootcause) { TdConnection con = new TdConnection(strConnString); // Date = CAST(Date AS FORMAT 'YYYY-MM-DD'); // TdTimestamp dt = new TdTimestamp(Date); // string dts = dt.ToString("MM/dd/yyyy HH:mm:ss"); //Define the Command Object Teradata.Client.Provider.TdCommand cmdAddDefect = new Teradata.Client.Provider.TdCommand(@"INSERT INTO coebatch.tbl_Defect Values('" + DefectID + "','" + DefectName + "','" + Date + "','" + Status + "','" + Cycle + "','" + Description + "','" + Project + "','" + Tester + "','" + TestcasesAssociated + "','" + Module + "','" + Assignedto + "','" + date1 + "','" + filenames + "','" + filesize + "',,'" + environment + "','" + severity + "','" + Projectname + "','" + Rootcause + "')", con); int DefectIDD = (int)GetNextDefectID(); int histid = 1; //DefectIDD = DefectIDD - 1; Teradata.Client.Provider.TdCommand cmdAddDefectHistory = new Teradata.Client.Provider.TdCommand(@"INSERT INTO coebatch.tbl_Defect_History Values('" + DefectIDD + "','" + DefectName + "','" + Date + "','" + Status + "','" + Cycle + "','" + Description + "','" + Project + "','" + Tester + "','" + TestcasesAssociated + "','" + Module + "','" + Assignedto + "','" + date1 + "','" + histid + "','" + Loginuser + "','" + environment + "','" + severity + "', '" + Projectname + "','" + Rootcause + "')", con); int intLengt = 0; byte[] objDat; objDat = new byte[intLengt]; string DataOb = Convert.ToString(objDat); // cmdAddDefect.Parameters.Add(new Teradata.Client.Provider.TdParameter("@Attachments", (object)objDat)); // cmdAddDefectHistory.Parameters.Add(new Teradata.Client.Provider.TdParameter("@Attachments", (object)objDat)); try { //Open the Connection to connect to the database con.Open(); //Execute the Query cmdAddDefect.ExecuteNonQuery(); cmdAddDefectHistory.ExecuteNonQuery(); } catch (Teradata.Client.Provider.TdException ex) { throw ex; } finally { //Close the Connection from the Database con.Close(); } }
public int AddAttachments(string text, string filename, int Defectid1, int id1) { TdConnection con = new TdConnection(strConnString); int id = 0; //Define the Command Object Teradata.Client.Provider.TdCommand cmdAddAttach = new Teradata.Client.Provider.TdCommand(@"INSERT INTO coebatch.tbl_Attachments Values('" + text + "','" + filename + "'," + Defectid1 + "," + id1 + " )", con); try { //Open the Connection to connect to the database con.Open(); //Execute the Query cmdAddAttach.ExecuteNonQuery(); id = 1; return(id); } catch (Teradata.Client.Provider.TdException ex) { throw ex; } finally { //Close the Connection from the Database con.Close(); } return(id); }