public void DeleteComplaintDetail(ComplaintDetail complaintDetail) { if (complaintDetail == null) { throw new ArgumentNullException(nameof(complaintDetail)); } _context.ComplaintDetails.Remove(complaintDetail); }
public void AddComplaintDetail(ComplaintDetail complaintDetail) { if (complaintDetail == null) { throw new ArgumentNullException(nameof(complaintDetail)); } // the repository fills the id (instead of using identity columns) complaintDetail.Id = Guid.NewGuid(); _context.ComplaintDetails.Add(complaintDetail); }
//Update Complaint or Insert New Complaint public int SaveNewComplaintOrUpdate(ComplaintDetail compDetail) { lock (objLocker) { if (compDetail.ComplaintID != 0) { complaintDatabase.Update(compDetail); return(compDetail.ComplaintID); } else { return(complaintDatabase.Insert(compDetail)); } } }
public ICollection <ComplaintDetail> GetData() { var command = _dbComplaintDetailCommandProvider.GetGetDataDbCommand(); command.Connection = _dbConnHolder.Connection; _dbConnHolder.Open(); var entList = new Collection <ComplaintDetail>(); var reader = new SafeDataReader(command.ExecuteReader(CommandBehavior.CloseConnection)); while (reader.Read()) { var tempEntity = new ComplaintDetail(reader.GetInt32("Id"), reader.GetString("Name"), reader.GetString("Description"), reader.GetString("LocationDetails"), reader.GetString("ReportingParty")); entList.Add(tempEntity); } reader.Close(); return(entList); }
public bool EditComplaintStatus(ComplaintDetail Model) { try { using (PublicBL publicBL = new PublicBL()) { Complaint complaint = new Complaint { ComplaintStatusID = Model.ComplaintStatusID, ComplaintID = Model.ComplaintsID }; return(publicBL.EditComplaintStatus(complaint)); } } catch (Exception ex) { return(false); } }
public ComplaintDetail GetMyComplaintsDetailsAPI(int complainID) { try { using (PublicBL publicBL = new PublicBL()) { ComplaintDetail Grid = publicBL.GetMyComplaintsDetails(complainID); if (Grid != null) { Grid.Refund = Grid.RefundBit ? "Yes" : "No"; } return(Grid); } } catch (Exception ex) { return(null); } }
public PagedResult <ComplaintDetail> GetDataPageable(string sortExpression, int page, int pageSize) { var command = _dbComplaintDetailCommandProvider.GetGetDataPageableDbCommand(sortExpression, page, pageSize); command.Connection = _dbConnHolder.Connection; _dbConnHolder.Open(); var entList = new Collection <ComplaintDetail>(); var reader = new SafeDataReader(command.ExecuteReader(CommandBehavior.CloseConnection)); while (reader.Read()) { var tempEntity = new ComplaintDetail(reader.GetInt32("Id"), reader.GetString("Name"), reader.GetString("Description"), reader.GetString("LocationDetails"), reader.GetString("ReportingParty")); entList.Add(tempEntity); } reader.Close(); var totalCount = GetRowCount(); var pagedResults = new PagedResult <ComplaintDetail>(page, pageSize, totalCount, entList); return(pagedResults); }
protected void btnPostComplaint_Click(object sender, EventArgs e) { string url = "http://localhost:54106/1.0/Complaint/New"; ComplaintDetail complaintDetail = new ComplaintDetail { AccountId = accountId, EntityId = entityId, LocationTypeId = locationTypeId, Location = location, Subject = subject, Description = description, UserFile = ParseImage(imagePath) }; string jsonComplaintDetail = complaintDetail.ToJSON(); HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url); GETRequest.Method = "POST"; using (var streamWriter = new StreamWriter(GETRequest.GetRequestStream())) { streamWriter.Write(jsonComplaintDetail); streamWriter.Flush(); streamWriter.Close(); HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse(); Stream GETResponseStream = GETResponse.GetResponseStream(); StreamReader sr = new StreamReader(GETResponseStream); lblResult.Text = sr.ReadToEnd(); } }
protected void btnPostComplaintSupport_Click(object sender, EventArgs e) { string url = "http://localhost:54106/1.0/Complaint/Support"; ComplaintDetail complaintDetail = new ComplaintDetail { ComplaintId = complaintId, AccountId = accountId }; string jsonComplaintDetail = complaintDetail.ToJSON(); HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url); GETRequest.Method = "POST"; using (var streamWriter = new StreamWriter(GETRequest.GetRequestStream())) { streamWriter.Write(jsonComplaintDetail); streamWriter.Flush(); streamWriter.Close(); HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse(); Stream GETResponseStream = GETResponse.GetResponseStream(); StreamReader sr = new StreamReader(GETResponseStream); lblResult.Text = sr.ReadToEnd(); } }