private void createNewTicket(RequestLongForm r) { string sql = "insert into [ServiceDesk].[dbo].[Request] (WorkOrderID) VALUES(" + r.WORKORDERID.ToString() + ")"; executeSQL(sql, connectionStringData); // WriteLog(r.WORKORDERID, "UPDATE FULL"); }
private void updateLongRequestToDatabase(RequestLongForm r) { //string completeTime = (r.COMPLETEDTIME.Length < 10) ? "null" : ("'" + (UnixEpoch.AddMilliseconds(Convert.ToDouble(r.COMPLETEDTIME))).ToShortTimeString() + "'"); //string respondedTime = (r.RESPONDEDTIME.Length < 10) ? "null" : ("'" + (UnixEpoch.AddMilliseconds(Convert.ToDouble(r.RESPONDEDTIME))).ToShortTimeString() +"'"); //string dueByTime = (r.DUEBYTIME.Length < 10) ? "null" : "'" + (UnixEpoch.AddMilliseconds(Convert.ToDouble(r.DUEBYTIME))).ToShortTimeString() + "'"; string sql = "update Request set "; sql += "[RequesterEmail]='" + Sanitize(r.REQUESTEREMAIL) + "',"; sql += "[CreatedTime]=" + UnixTimeinMStoSQLTime(r.CREATEDTIME) + ","; sql += "[DueByTime]=" + UnixTimeinMStoSQLTime(r.DUEBYTIME) + ","; sql += "[RespondedTime]=" + UnixTimeinMStoSQLTime(r.RESPONDEDTIME) + ","; sql += "[CompletedTime]=" + UnixTimeinMStoSQLTime(r.COMPLETEDTIME) + ","; sql += "[ShortDescription]='" + Sanitize(r.SHORTDESCRIPTION) + "',"; sql += "[TimeSpentOnReqInMinutes]=" + ConvertHrsMnsStringToMinutes(r.TIMESPENTONREQ) + ","; sql += "[RequestTemplate]='" + r.REQUESTTEMPLATE + "',"; sql += "[TemplateID]='" + r.TEMPLATEID + "',"; sql += "[SLA]='" + r.SLA + "',"; //sql += "[NotificationStatus]='" + r.Not + "',"; sql += "[Asset]='" + Sanitize(r.ASSET) + "',"; sql += "[HasAttachments]=" + ((r.HASATTACHMENTS.ToLower() == "true") ? "1" : "0") + ","; sql += "[HasNotes]=" + ((r.HASNOTES.ToLower() == "true") ? "1" : "0") + ","; sql += "[HasConversation]=" + ((r.HASCONVERSATION.ToLower() == "true") ? "1" : "0") + ","; sql += "[UDF_DATE1]=" + UnixTimeinMStoSQLTime(r.UDF_DATE1) + ","; sql += "[UDF_DATE2]=" + UnixTimeinMStoSQLTime(r.UDF_DATE2) + ","; sql += "[UDF_DATE3]=" + UnixTimeinMStoSQLTime(r.UDF_DATE3) + ","; sql += "[UDF_DATE4]=" + UnixTimeinMStoSQLTime(r.UDF_DATE4) + ","; sql += "[LongRequestID]='" + r.LONG_REQUESTID + "', "; sql += "[HasFullInfo]=1 "; sql += "WHERE WorkOrderID=" + r.WORKORDERID.ToString(); executeSQL(sql, connectionStringData); WriteLog(r.WORKORDERID, "UPDATE FULL"); }