示例#1
0
        public Case(int id)
            : base(id)
        {
            XmlReader xr = dao.GetCase(id);

            if (!xr.Read())
            {
                throw new Exception("Wybrana sprawa nie istnieje");
            }
            try
            {
                XPathDocument  xpd = new XPathDocument(xr);
                XPathNavigator xpn = xpd.CreateNavigator();
                this.name        = xpn.SelectSingleNode("/sprawa/nazwa") == null ? string.Empty : xpn.SelectSingleNode("/sprawa/nazwa").Value;
                this.description = xpn.SelectSingleNode("/sprawa/opis") == null ? string.Empty : xpn.SelectSingleNode("/sprawa/opis").Value;

                DateTime tmpDate;
                if (DateTime.TryParse(xpn.SelectSingleNode("/sprawa/dataRozpoczecia").Value, out tmpDate))
                {
                    this.creationDate = tmpDate;
                }

                this.owner = (xpn.SelectSingleNode("/sprawa/metadane/referent") == null) ? string.Empty : xpn.SelectSingleNode("/sprawa/metadane/referent").Value;
                if (this.owner.Equals(String.Empty))
                {
                    this.owner = (xpn.SelectSingleNode("/sprawa/referent") == null) ? string.Empty : xpn.SelectSingleNode("/sprawa/metadane/referent").Value;
                }
                //XPathIteratorReader xpir = new XPathIteratorReader(xpn.Select("/dokument/metadane"));

                meta = new Metadata(xpn.Select("/sprawa/metadane/*"));
            }
            catch {
                throw new Exception("Wybrana sprawa nie istnieje");
            }
        }
示例#2
0
 string IViewCaseTask.GetCaseInfo(int caseId)
 {
     using (XmlReader xr = dao.GetCase(caseId))
     {
         if (!xr.Read())
         {
             return(string.Empty);
         }
         return(xr.ReadOuterXml());
     }
 }
示例#3
0
        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;
        }