Пример #1
0
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            if (innerAnyQuery.AnyQueryID == String.Empty)
                innerAnyQuery.AnyQueryID = CliUtils.GetMenuID(innerAnyQuery.PackageForm);

            frmAnyQuerySaveLoad faqsl = new frmAnyQuerySaveLoad(innerAnyQuery.BindingSource, "Load", innerAnyQuery.AnyQueryID);
            faqsl.ShowDialog();
            if (faqsl.isOK && faqsl.fileName != String.Empty)
            {
                String templateID = faqsl.fileName;
                String text = String.Empty;
                String tableName = String.Empty;
                object[] param = new object[2];
                param[0] = innerAnyQuery.AnyQueryID;
                param[1] = templateID;
                object[] myRet = CliUtils.CallMethod("GLModule", "AnyQueryLoad", param);
                if (myRet != null && myRet[0].ToString() == "0")
                {
                    text = myRet[1].ToString();
                    tableName = myRet[2].ToString();
                }

                String message = String.Empty;
                if (tableName == "" || tableName != GetTableName())
                {
                    message = SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "AnyQuery", "CheckTable");
                    MessageBox.Show(message);
                    this.DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                List<Panel> tempPanel = new List<Panel>();
                for (int i = 0; i < this.panel2.Controls.Count; i++)
                {
                    if (this.panel2.Controls[i] is InfoRefButton && !(this.panel2.Controls[i] as InfoRefButton).autoPanel)
                    {
                        tempPanel.Add((this.panel2.Controls[i] as InfoRefButton).panel);
                    }
                }
                this.panel2.Controls.Clear();
                Count = 0;

                message = SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "AnyQuery", "ColumnValue");
                String[] ColumnValue = message.Split(';');
                Label labelColumn = new Label();
                labelColumn.Location = new Point(124, 16);
                labelColumn.Text = ColumnValue[0];
                this.panel2.Controls.Add(labelColumn);
                Label labelValue = new Label();
                labelValue.Location = new Point(335, 16);
                labelValue.Text = ColumnValue[1];
                this.panel2.Controls.Add(labelValue);
                Label conditionLabel = new Label();
                conditionLabel.Text = ColumnValue[2];
                conditionLabel.Location = new Point(477, 16);
                ComboBox cbCondition = new ComboBox();
                cbCondition.Name = "cbCondition";
                cbCondition.Location = new Point(557, 13);
                cbCondition.Size = new Size(54, 20);
                cbCondition.Items.AddRange(new String[] { "AND", "OR" });
                cbCondition.DropDownStyle = ComboBoxStyle.DropDownList;
                cbCondition.SelectedIndex = 0;

                InfoDataSet ids = null;
                if (innerAnyQuery.BindingSource != null)
                {
                    ids = innerAnyQuery.BindingSource.DataSource as InfoDataSet;

                    XmlDocument DBXML = new XmlDocument();
                    DBXML.LoadXml(text);
                    XmlNode aNode = DBXML.DocumentElement.FirstChild;

                    while (aNode != null)
                    {
                        Count++;
                        cbCondition.Text = CreateColumns(ids, aNode, tempPanel);
                        aNode = aNode.NextSibling;
                    }
                }

                this.panel2.Controls.Add(cbCondition);
                this.panel2.Controls.Add(conditionLabel);
            }
        }
Пример #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (innerAnyQuery.AnyQueryID == String.Empty)
                innerAnyQuery.AnyQueryID = CliUtils.GetMenuID(innerAnyQuery.PackageForm);

            frmAnyQuerySaveLoad faqsl = new frmAnyQuerySaveLoad(innerAnyQuery.BindingSource, "Save", innerAnyQuery.AnyQueryID);
            faqsl.ShowDialog();
            if (faqsl.isOK && faqsl.fileName != String.Empty)
            {
                String templateID = faqsl.fileName;
                String text = String.Empty;
                String xml = GetSaveXML();

                object[] param = new object[4];
                param[0] = innerAnyQuery.AnyQueryID;
                param[1] = templateID;
                param[2] = xml;
                param[3] = GetTableName();
                object[] myRet = CliUtils.CallMethod("GLModule", "AnyQuerySave", param);
                if (myRet != null && myRet[0].ToString() == "0")
                {
                    string message = SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "AnyQuery", "SaveSuccess");
                    MessageBox.Show(message);
                }
            }
        }