protected void executeCommand(object sender, EventArgs e) { int caseId = CoreObject.GetId(Request); if (caseId <= 0) { BaseContentPage.SetError("Nie wybrano sprawy", "~/Oczekuj¹ceZadania.aspx"); return; } //if(Session["idSprawy"]==null || !int.TryParse(Session["idSprawy"].ToString(),out caseId)){ // BaseContentPage.SetError("Nie wybrano sprawy","~/Oczekuj¹ceZadania.aspx"); // return; //} CaseDAO dao = new CaseDAO(); dao.RedirectCase(caseId, new Guid(Membership.GetUser().ProviderUserKey.ToString()), Membership.GetUser().UserName, Membership.GetUser().Comment, txtNote.Text, int.Parse(wydzial.SelectedItem.Value), int.Parse(pracownik.SelectedItem.Value), wydzial.SelectedItem.Text, pracownik.SelectedItem.Text); if (IsCaseVisibleToUser(new Guid(Membership.GetUser().ProviderUserKey.ToString()), caseId)) { Response.Redirect("~/Sprawy/HistoriaSprawy.aspx?id=" + caseId.ToString()); } else { Response.Redirect("~/OczekujaceZadania.aspx"); } }
public XmlDocument StatusSprawy(int numerPozycjiDziennika, int year) { using (XmlReader xr = new CaseDAO().GetCaseOrDocumentStatus(numerPozycjiDziennika, year)) { var doc = new XmlDocument(); doc.Load(xr); return(doc); } }
private void AssignDocumentToCase(int docId, int caseId) { try { CaseDAO caseDao = new CaseDAO(); caseDao.AssignDocumentToExistingCase(new Guid(Membership.GetUser().ProviderUserKey.ToString()), docId, caseId); } catch { throw new ArgumentException("Wyst¹pi³ problem z przypisaniem dokumentu do sprawy!"); } }
protected void zakonczAkcje(object sender, CommandEventArgs e) { if (e.CommandName == "Update") { if (Page.IsValid) { int id = -1; CaseDAO dao = new CaseDAO(); id = int.Parse((frmSprawa.FindControl("hfCaseId") as HiddenField).Value); string opis = (frmSprawa.FindControl("txtOpis") as TextBox).Text; string znakPisma = (frmSprawa.FindControl("txtZnakPisma") as TextBox).Text; DateTime dataRozpoczecia; if (!DateTime.TryParse((frmSprawa.FindControl("dataRozpoczecia") as TextBox).Text, out dataRozpoczecia)) { dataRozpoczecia = DateTime.MinValue; } DateTime dataPisma; if (!DateTime.TryParse((frmSprawa.FindControl("txtDataPisma") as TextBox).Text, out dataPisma)) { dataPisma = DateTime.MinValue; } DateTime dataZakonczenia; if (!DateTime.TryParse((frmSprawa.FindControl("dataZakonczenia") as TextBox).Text, out dataZakonczenia)) { dataZakonczenia = DateTime.MinValue; } string uwagi = (frmSprawa.FindControl("txtUwagi") as TextBox).Text; int status = int.Parse((frmSprawa.FindControl("ddlStatus") as DropDownList).SelectedValue); int nadawca = int.Parse((frmSprawa.FindControl("hfCustomerId") as HiddenField).Value); List <string> parameters = new List <string>(); parameters.Add(Membership.GetUser().Comment); ActionLogger al = new ActionLogger(new ActionContext(new Guid("05555FAA-A86A-40C1-9A69-6512276C7098"), new Guid(Membership.GetUser().ProviderUserKey.ToString()), Membership.GetUser().UserName, Membership.GetUser().Comment, parameters)); al.AppliesToCases.Add(id); al.Execute(); dao.UpdateCase(id, opis, znakPisma, dataRozpoczecia, dataPisma, dataZakonczenia, uwagi, status, nadawca, -1, new Guid(Membership.GetUser().ProviderUserKey.ToString())); Response.Redirect("~/Sprawy/AkcjeSprawy.aspx?id=" + id.ToString(), false); } } else if (e.CommandName == "Cancel") { Response.Redirect("~/Sprawy/AkcjeSprawy.aspx?id=" + CoreObject.GetId(Request)); } }
/// <summary> /// Get a specific Case /// </summary> /// <param name="id"></param> /// <returns></returns> // GET: api/Case/5 public Case Get(int id) { CaseDAO CaseRecordDAO = new CaseDAO(); Case CaseRecord = CaseRecordDAO.getCase(id); if (CaseRecord == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return(CaseRecord); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int caseId = CoreObject.GetId(Request); if (caseId > 0) { CaseDAO cd = new CaseDAO(); frmSprawa.ChangeMode(FormViewMode.Edit); XmlDataSource xds = new XmlDataSource(); using (XmlReader xr = cd.GetCase(caseId)) { if (!xr.Read()) { xds.Data = string.Empty; } else { xds.Data = xr.ReadOuterXml(); } } xds.EnableCaching = false; if (xds.Data != "") { xds.XPath = "/sprawa"; frmSprawa.DataSource = xds; } else { frmSprawa.DataSource = null; } frmSprawa.DataBind(); } } if (customer != null) { customer.SearchCustomers += new EventHandler <SearchCustomersEventArgs>(customersList.FindCustomers); customer.SearchCustomers += new EventHandler <SearchCustomersEventArgs>(customer_SearchCustomers); customer.SearchListVisible += new EventHandler <SearchCustomersEventArgs>(customersList.SearchListVisible); customer.OnCustomerAdded += new EventHandler(customer_OnCustomerAdded); customersList.AddNewCustomer += new EventHandler(customer.AddNewCustomer); customersList.EditCustomer += new EventHandler(customer.EditCustomer); customersList.SelectCustomer += new EventHandler(customer.SelectCustomer); customersList.SelectCustomer += new EventHandler(onSelectCustomer); } customersList.AdminMode = false; customersList.PageSize = 5; }
private void SetPageTitle() { try { if (caseId > 0) { CaseDAO caseDao = new CaseDAO(); Page.Title = String.Format("Tworzenie nowego dokumentu dla sprawy {0}", caseDao.GetCaseSignature(caseId)); } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
private string[] getItemsCB(int caseId) { CaseDAO dao = new CaseDAO(); string[] it = new string[] { caseId.ToString(), null, null }; using (IDataReader dr = dao.GetBriefcaseForCase(caseId)) { if (dr.Read()) { it[1] = dr.GetInt32(0).ToString(); it[2] = dr.GetString(1); } } return(it); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int caseId = CoreObject.GetId(Request); if (caseId == 0) { wyslij.Enabled = false; return; } SMSData data = new CaseDAO().GetSMSDataForCase(caseId); txtNumerSMS.Text = data.PhoneNumber; txtMessage.Text = data.Message; } }
protected void removeDocumentFromCase(int docID) { //usuniecie dokumentu ze sprawy. zwrotnie idsprawy lub null gdy zostala usunieta int caseID; CaseDAO dao = new CaseDAO(); caseID = dao.RemoveDocumentFromCase(docID, (Guid)Membership.GetUser().ProviderUserKey); string caseNumber; if (caseID > 0) { caseNumber = dao.GetCaseSignature(caseID); } else { caseNumber = "(wraz ze sprawą)"; } //odnotowanie wykonania akcji string user = Membership.GetUser().Comment + " (" + Membership.GetUser().UserName + ")"; List <string> parameters = new List <string>(); parameters.Add(docID.ToString()); parameters.Add(caseNumber); parameters.Add(user); ActionLogger al = new ActionLogger(new ActionContext(new Guid("FA7D4334-CF40-4086-877B-25E8D0C48CCA"), new Guid(Membership.GetUser().ProviderUserKey.ToString()), Membership.GetUser().UserName, Membership.GetUser().Comment, parameters)); al.AppliesToDocuments.Add(docID); if (caseID != 0) { al.AppliesToCases.Add(caseID); } al.ActionData.Add("NumerDokumentu", docID.ToString()); al.ActionData.Add("uzytkownik", user); al.ActionData.Add("NumerSprawy", caseID > 0?caseNumber:"(sprawa usunięta)"); if (caseID > 0) { al.ActionData.Add("IDSprawy", caseID.ToString()); } al.Execute(); Session["caseToRemoveFrom"] = caseID; }
/// <summary> /// Create a Case /// </summary> /// <param name="value"></param> /// <returns></returns> // POST: api/Case public HttpResponseMessage Post([FromBody] Case value) { CaseDAO CaseRecordDAO = new CaseDAO(); int CaseID; //execute save method and return identity CaseID = CaseRecordDAO.createCase(value); value.CaseID = CaseID; //create response header HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created); response.Headers.Location = new Uri(Request.RequestUri, String.Format("Case/{0}", CaseID)); //return response header return(response); }
/// <summary> /// Update a Case /// </summary> /// <param name="id"></param> /// <param name="value"></param> /// <returns></returns> // PUT: api/Case/5 public HttpResponseMessage Put(int id, [FromBody] Case value) { CaseDAO CaseRecordDAO = new CaseDAO(); bool recordExisted = false; recordExisted = CaseRecordDAO.updateCase(id, value); HttpResponseMessage response; if (recordExisted) { response = Request.CreateResponse(HttpStatusCode.NoContent); } else { response = Request.CreateResponse(HttpStatusCode.NotFound); } return(response); }
/// <summary> /// Delete a Case (sets deleted flag in DB) /// </summary> /// <param name="id"></param> /// <returns></returns> // DELETE: api/Case/5 public HttpResponseMessage Delete(int id) { CaseDAO CaseRecordDAO = new CaseDAO(); bool recordExisted = false; recordExisted = CaseRecordDAO.deleteCase(id); HttpResponseMessage response; if (recordExisted) { response = Request.CreateResponse(HttpStatusCode.NoContent); } else { response = Request.CreateResponse(HttpStatusCode.NotFound); } return(response); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int caseId = CoreObject.GetId(Request); if (caseId > 0) { if (!Page.User.IsInRole("Administratorzy") && !(new CaseDAO()).IsCaseVisibleForUser(caseId, new Guid(Membership.GetUser().ProviderUserKey.ToString()))) { BaseContentPage.SetError("Nie masz uprawnień do tej sprawy", "~/OczekujaceZadania.aspx"); } } if (caseId <= 0) { BaseContentPage.SetError("Nie ma takiej sprawy", "~/OczekujaceZadania.aspx"); } CaseDAO cd = new CaseDAO(); rejestry.DataSource = cd.GetCaseRegistryItems(caseId); rejestry.DataBind(); } }
/// <summary> /// List all cases /// </summary> /// <returns></returns> // GET: api/Case public ArrayList Get() { CaseDAO CaseListDAO = new CaseDAO(); return(CaseListDAO.getCaseList()); }