Пример #1
0
        protected void lnkImportJRWA_Click(object sender, EventArgs e)
        {
            if (fuplJRWA.HasFile)
            {
                try
                {
                    string filePath = Server.MapPath(ConfigurationManager.AppSettings["katalogRoboczy"].ToString()) + "\\" + fuplJRWA.FileName;
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                    fuplJRWA.SaveAs(filePath);

                    DataSet dsJRWA = new DataSet();
                    dsJRWA.ReadXml(filePath);

                    JrwaDAO jd = new JrwaDAO();
                    jd.ImportJRWA(dsJRWA.GetXml());
                    File.Delete(filePath);
                    LoadJRWATree();
                }
                catch //(Exception ex)
                {
                    SetError("Nie uda³o siê zaimportowaæ danych.");
                }
            }
            else
            {
                SetError("Wybierz plik z danymi do zaimportowania.");
            }
        }
Пример #2
0
        private void LoadJRWA(int id)
        {
            JrwaDAO jd = new JrwaDAO();

            frmJRWA.DataSource = jd.GetJRWA(id);
            frmJRWA.DataBind();
        }
Пример #3
0
        protected void frmJRWA_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            if (Page.IsValid)
            {
                JrwaDAO jd = new JrwaDAO();

                string symbol = ((TextBox)frmJRWA.FindControl("txtSymbol")).Text;
                symbol = ((Label)frmJRWA.FindControl("lblPArentSymbol")).Text + symbol;
                string nazwa    = ((TextBox)frmJRWA.FindControl("txtNazwa")).Text;
                string katAKM   = ((TextBox)frmJRWA.FindControl("txtKategoriaAKM")).Text;
                string katAIK   = ((TextBox)frmJRWA.FindControl("txtKategoriaAIK")).Text;
                string uwagi    = ((TextBox)frmJRWA.FindControl("txtUwagi")).Text;
                bool   bAktywna = ((CheckBox)frmJRWA.FindControl("ckbAktywna")).Checked;

                int?idRodzica = null;
                if (tvJRWA.SelectedNode != null && !tvJRWA.SelectedValue.Equals("0"))
                {
                    idRodzica = int.Parse(tvJRWA.SelectedNode.Value);
                }

                if (jd.ExistsJRWA(symbol, -1))
                {
                    WebMsgBox.Show(this, string.Format("JRWA o symbolu {0} ju¿ istnieje.", symbol));
                    e.Cancel = true;
                    return;
                }
                else
                {
                    jd.InsertJRWA(idRodzica, symbol, nazwa, katAKM, katAIK, uwagi, bAktywna);
                }
                LoadJRWATree();
                frmJRWA.ChangeMode(FormViewMode.ReadOnly);
                frmJRWA.DataBind();
            }
        }
Пример #4
0
        protected void lnkAddJRWA_Click(object sender, EventArgs e)
        {
            if (tvJRWA.SelectedNode != null)
            {
                JrwaDAO      jd     = new JrwaDAO();
                int          jrwaId = int.Parse(tvJRWA.SelectedNode.Value);
                DbDataReader dr     = (DbDataReader)jd.GetJRWA(jrwaId);

                string symbol = "(brak)";
                string nazwa  = "(brak)";
                if (dr.HasRows)
                {
                    if (dr.Read())
                    {
                        symbol = dr["symbol"].ToString();
                        nazwa  = dr["nazwa"].ToString();
                    }
                }

                ((TextBox)frmTeczka.FindControl("txtJRWA")).Text                = symbol;
                ((Label)frmTeczka.FindControl("lblOpisJRWA")).Text              = nazwa;
                ((HiddenField)frmTeczka.FindControl("hfIdJRWA")).Value          = jrwaId.ToString();
                ((NumeracjaSpraw)frmTeczka.FindControl("NumeracjaSpraw1")).Jrwa = symbol;
            }
            else
            {
                WebMsgBox.Show(this, "Wybierz JRWA");
            }
        }
Пример #5
0
        protected void lnkSelectJRWA_Click(object sender, EventArgs e)
        {
            pnlJRWA.Visible = true;
            JrwaDAO jd = new JrwaDAO();

            dsxmlJRWA.Data = jd.GetActiveJRWAListXml();
            tvJRWA.DataBind();
        }
Пример #6
0
        protected void lnkJRWATree_Click(object sender, EventArgs e)
        {
            pnlJRWA.Visible = true;
            JrwaDAO jd = new JrwaDAO();

            dsxmlJRWA.Data = jd.GetActiveJRWAListXml();
            tvJRWA.DataBind();
            tvJRWA.CollapseAll();
            pnlGroups.Visible = false;
        }
Пример #7
0
        private void LoadJRWATree()
        {
            JrwaDAO jd = new JrwaDAO();

            xmldsPrintJRWA.Data = "";
            xmldsPrintJRWA.Data = jd.GetFullJrwaList();

            XmlDocument doc = xmldsPrintJRWA.GetXmlDocument();

            tvPrintJRWA.Nodes.Clear();
            tvPrintJRWA.DataBind();
            tvPrintJRWA.ExpandAll();
        }
Пример #8
0
        protected void lnkExportJRWA_Click(object sender, EventArgs e)
        {
            Response.Clear();
            Response.AddHeader("content-disposition", string.Format("attachment; filename=ExportJRWA_{0}.xml", DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss")));
            Response.Charset = "utf-8";

            Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
            Response.ContentType = "text/xml";
            //System.IO.StringWriter stringWrite = new System.IO.StringWriter();

            JrwaDAO jd     = new JrwaDAO();
            string  export = jd.ExportJRWA();

            //stringWrite.Write(export);

            //Response.Write(stringWrite.ToString());
            Response.Write(export);
            Response.End();
        }
Пример #9
0
        private void LoadJRWATree()
        {
            try
            {
                string selected = "";
                if (tvJRWA.SelectedNode != null)
                {
                    selected = tvJRWA.SelectedNode.ValuePath;
                }

                JrwaDAO jd = new JrwaDAO();
                dsxmlJRWA.Data = jd.GetJRWAListXML();

                tvJRWA.DataBind();

                // dodanie elementu ROOT
                TreeNode node = new TreeNode("JRWA", "0");
                node.Target = "1";
                while (tvJRWA.Nodes.Count > 0)
                {
                    node.ChildNodes.Add(tvJRWA.Nodes[0]);
                }

                foreach (TreeNode tNode in node.ChildNodes)
                {
                    SetInactiveNodes(tNode);
                }
                //tvJRWA.Nodes.Clear();
                //node.Selected = true;
                node.Expand();
                tvJRWA.Nodes.Add(node);

                if (tvJRWA.FindNode(selected) != null)
                {
                    tvJRWA.FindNode(selected).Select();
                }
                ExpandNode(tvJRWA.SelectedNode);
            }
            catch
            { }
        }
Пример #10
0
        protected void lnkAddJRWA_Click(object sender, EventArgs e)
        {
            if (tvJRWA.SelectedNode != null)
            {
                JrwaDAO jd     = new JrwaDAO();
                int     jrwaId = int.Parse(tvJRWA.SelectedNode.Value);

                using (DbDataReader dr = (DbDataReader)jd.GetJRWA(jrwaId))
                {
                    if (dr.HasRows)
                    {
                        if (dr.Read())
                        {
                            hfJRWAId.Value = jrwaId.ToString(); //dr["symbol"].ToString();
                            txtJRWA.Text   = dr["nazwa"].ToString();
                        }
                    }
                }
            }
            else
            {
                WebMsgBox.Show(this, "Wybierz JRWA");
            }
        }
Пример #11
0
        protected void frmJRWA_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            if (Page.IsValid)
            {
                JrwaDAO jd = new JrwaDAO();

                string parentSymbol = string.Empty;

                int id        = int.Parse(tvJRWA.SelectedNode.Value);
                int?idRodzica = null;

                string symbol          = ((TextBox)frmJRWA.FindControl("txtSymbol")).Text;
                Label  lblParentSymbol = ((Label)frmJRWA.FindControl("lblParentSymbol"));
                if (lblParentSymbol != null)
                {
                    if (lblParentSymbol.Visible && lblParentSymbol.Text.Length > 0)
                    {
                        parentSymbol = lblParentSymbol.Text;
                        symbol       = lblParentSymbol.Text + symbol;
                        idRodzica    = jd.GetJRWAIdBySymbol(parentSymbol);
                    }
                    else
                    {
                        parentSymbol = symbol.Substring(0, symbol.Length - 1);
                        idRodzica    = jd.GetJRWAIdBySymbol(parentSymbol);
                        if (idRodzica == -1 && parentSymbol.Length > 0)
                        {
                            WebMsgBox.Show(this, string.Format("Brak aktywnego wêz³a JRWA o symbolu {0}.", parentSymbol));
                            e.Cancel = true;
                            return;
                        }
                    }
                }

                string nazwa    = ((TextBox)frmJRWA.FindControl("txtNazwa")).Text;
                string katAKM   = ((TextBox)frmJRWA.FindControl("txtKategoriaAKM")).Text;
                string katAIK   = ((TextBox)frmJRWA.FindControl("txtKategoriaAIK")).Text;
                string uwagi    = ((TextBox)frmJRWA.FindControl("txtUwagi")).Text;
                bool   bAktywna = ((CheckBox)frmJRWA.FindControl("ckbAktywna")).Checked;



                //if(jd.Get

                HiddenField hfParentJRWAId = ((HiddenField)frmJRWA.FindControl("hfTargetJRWAParentId"));
                if (hfParentJRWAId != null && hfParentJRWAId.Value != null && hfParentJRWAId.Value.Length > 0 && parentSymbol.Length == 0)
                {
                    idRodzica = int.Parse(hfParentJRWAId.Value);
                }
                else
                if (tvJRWA.SelectedNode != null && tvJRWA.SelectedNode.Parent != null && parentSymbol.Length == 0)
                {
                    idRodzica = int.Parse(tvJRWA.SelectedNode.Parent.Value);
                }

                if (idRodzica == 0)
                {
                    idRodzica = null;
                }

                if (parentSymbol.Length > 0)
                {
                    idRodzica = jd.GetJRWAIdBySymbol(parentSymbol);
                }
                else
                {
                    idRodzica = null;
                }

                if (jd.ExistsJRWA(symbol, id))
                {
                    WebMsgBox.Show(this, string.Format("JRWA o symbolu {0} ju¿ istnieje.", symbol));
                    e.Cancel = true;
                    return;
                }
                else
                {
                    jd.UpdateJRWA(id, idRodzica, symbol, nazwa, katAKM, katAIK, uwagi, bAktywna);
                }
                frmJRWA.ChangeMode(FormViewMode.ReadOnly);
                LoadJRWA(id);
                LoadJRWATree();
            }
        }