public HttpResponseMessage UpdateComment(Bug input) { StringBuilder sblogs = new StringBuilder(); string methodname = "UpdateComment"; try { //StringBuilder sblogs = new StringBuilder(); sblogs.AppendLine("UpdateComment start"); Bugwrapper root = new Bugwrapper(); root.root = input; var json = JsonConvert.SerializeObject(root, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); sblogs.AppendLine("UpdateComment input : " + json); sblogs.AppendLine("db call started : "); string result = UpdateCommentInformation(json); sblogs.AppendLine("db call done : "); objrm.Message = result; sblogs.AppendLine("data send to UI : "); Logging.AddtoLogFile(sblogs.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, objrm)); } catch (Exception ex) { sblogs.AppendLine("exception : " + ex.Message); Logging.AddtoLogFile(sblogs.ToString(), methodname + "_error"); return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } }
public HttpResponseMessage BugListByBugid(Bug input) { StringBuilder sblogs = new StringBuilder(); string methodname = "BugListByBugid"; try { //StringBuilder sblogs = new StringBuilder(); sblogs.AppendLine("BugListByBugid start"); Bugwrapper root = new Bugwrapper(); root.root = input; var json = JsonConvert.SerializeObject(root, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); sblogs.AppendLine("BugListByBugid input : " + json); sblogs.AppendLine("db call started : "); string result = Buglistbybugid(json); sblogs.AppendLine("db call done : "); var obj = JsonConvert.DeserializeObject <dynamic>(result); string path = ConfigurationManager.AppSettings["attachmentpath"].ToString(); sblogs.AppendLine("attachmentpath : "); // Assigning path to object logo path if (obj != null) { for (var i = 0; i < obj.Count; i++) { obj[i].attachmentpath = path + "Images/Bug Attachments/" + obj[i].bug_attachment;; } var jsonobj = JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); objrm.Message = jsonobj; } else { objrm.Message = result; } sblogs.AppendLine("data send to UI : "); Logging.AddtoLogFile(sblogs.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, objrm)); } catch (Exception ex) { sblogs.AppendLine("exception : " + ex.Message); Logging.AddtoLogFile(sblogs.ToString(), methodname + "_error"); return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } }
public HttpResponseMessage BugList_total(Bug input) { StringBuilder sblogs = new StringBuilder(); string methodname = "BugList_total"; try { //StringBuilder sblogs = new StringBuilder(); sblogs.AppendLine("BugList_total start"); Bugwrapper root = new Bugwrapper(); root.root = input; var json = JsonConvert.SerializeObject(root, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); sblogs.AppendLine("BugList_total input : " + json); sblogs.AppendLine("db call started : "); string result = Buglisttotal_byprojid(json); sblogs.AppendLine("db call done : "); var obj = JsonConvert.DeserializeObject <dynamic>(result); string path = ConfigurationManager.AppSettings["attachmentpath"].ToString(); // objrm.Message1 = obj; objrm.Message1 = result; sblogs.AppendLine("data send to UI : "); Logging.AddtoLogFile(sblogs.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, objrm)); } catch (Exception ex) { sblogs.AppendLine("exception : " + ex.Message); Logging.AddtoLogFile(sblogs.ToString(), methodname + "_error"); return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } }
public HttpResponseMessage EmailNotification(Bug input) { StringBuilder sblog = new StringBuilder(); string methodname = "EmailNotification"; try { sblog.AppendLine("EmailNotification"); Bugwrapper root = new Bugwrapper(); root.root = input; var json = JsonConvert.SerializeObject(root, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); String result = Email(json); sblog.AppendLine("result : " + result); sblog.AppendLine("input json " + json); var obj = JsonConvert.DeserializeObject <dynamic>(result); var data = obj[0]; ////Email notification String strHTML = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("~/Template/Emailnotification.html")); sblog.AppendLine("reading template is done "); try { //strHTML = strHTML.Replace("{{#username#}}", data.user_username.Value); strHTML = strHTML.Replace("{{#projname#}}", data.proj_name.Value); strHTML = strHTML.Replace("{{#bugtitle#}}", data.bug_title.Value); strHTML = strHTML.Replace("{{#description#}}", data.bug_description.Value); strHTML = strHTML.Replace("{{#bugid#}}", data.bug_id.Value.ToString()); strHTML = strHTML.Replace("{{#status#}}", data.status_name.Value); if (input.user_emailid == null) { strHTML = strHTML.Replace("{{#assignee#}}", input.bug_assignedby); } else { strHTML = strHTML.Replace("{{#assignee#}}", input.user_emailid); } } catch (Exception ex) { sblog.AppendLine("exception while replacing html"); } try { if (data.user_emailid.Value == "") { sblog.AppendLine("SendMail called"); strHTML = strHTML.Replace("{{#emailid#}}", data.user_emailid); MailHelper.SendMail(input.user_emailid, "Bug", strHTML); } else { sblog.AppendLine("SendMail else called "); strHTML = strHTML.Replace("{{#emailid#}}", data.user_emailid.Value); MailHelper.SendMail(data.user_emailid.Value, "Bug", strHTML); } } catch (Exception ex) { //throw; sblog.AppendLine("SendMail exception " + ex.Message); Logging.AddtoLogFile(sblog.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } var jsonobj = JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-ddThh:mm:ssZ" }); objrm.Message = jsonobj; Logging.AddtoLogFile(sblog.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, objrm)); } catch (Exception ex) { sblog.AppendLine("SendMail exception " + ex.Message); Logging.AddtoLogFile(sblog.ToString(), methodname); return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } }