Example #1
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            try
            {
                InputBox box = new InputBox();
                if (box.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string   url = box.InputString;
                XElement req = new XElement("Request", new XElement("URL", url));

                ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                conn.CallService("UDMService.ForceRegistry", new Envelope(new XStringHolder(req)));

                MessageBox.Show("註冊 UDM 完成。");
                OnPrimaryKeyChanged(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvUDM.SelectedRows.Count <= 0)
                {
                    return;
                }

                DialogResult dr = MessageBox.Show("如果 UDM 包含 UDT 會一同刪除!您確定?", "Campus", MessageBoxButtons.YesNo);
                if (dr == DialogResult.No)
                {
                    return;
                }

                DataGridViewRow row  = dgvUDM.SelectedRows[0];
                string          name = (row.DataBoundItem as UDMGridRow).Name;
                XElement        req  = new XElement("Request", new XElement("ModuleName", name));

                ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                conn.CallService("UDMService.RemoveModule", new Envelope(new XStringHolder(req)));

                MessageBox.Show("刪除 UDM 完成。");
                OnPrimaryKeyChanged(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private static void ExecuteTasks(string sql)
        {
            MultiTaskingRunner runner = new MultiTaskingRunner();

            List <XElement> rsps = new List <XElement>();

            foreach (string uid in Program.MainPanel.SelectedSource)
            {
                string           name = Program.GlobalSchoolCache[uid].Title;
                ConnectionHelper ch   = ConnectionHelper.GetConnection(uid);
                runner.AddTask(string.Format("{0}({1})", name, uid), (x) =>
                {
                    XElement req = new XElement("Request",
                                                new XElement("SQL", sql));

                    Envelope rsp = ch.CallService("UDTService.DML.Query", new Envelope(new XStringHolder(req)));

                    lock (rsps)
                    {
                        XElement r = XElement.Parse(rsp.BodyContent.XmlString);
                        r.SetAttributeValue("UID", ((object[])x)[0].ToString());
                        rsps.Add(r);
                    }
                }, new object[] { uid, ch }, new CancellationTokenSource());
            }

            runner.ExecuteTasks();

            ExportToExcel(rsps);
        }
Example #4
0
        private void UpdateUDM(ConnectionHelper conn, string name)
        {
            XElement req = new XElement("Request",
                                        new XElement("ModuleName", name));

            conn.CallService("UDMService.UpdateModule", new Envelope(new XHelper(req)));
        }
Example #5
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            try
            {
                InputBox box = new InputBox();
                if (box.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string   url = box.InputString;
                XElement req = new XElement("Request",
                                            new XElement("Module",
                                                         new XElement("Field",
                                                                      new XElement("ModuleUrl", url),
                                                                      new XElement("Type", "FiscaAEModule"),
                                                                      new XElement("Memo", "集中安裝"),
                                                                      new XElement("Config",
                                                                                   new XElement("Content",
                                                                                                new XElement("VersionOption", "Stable"))))));

                ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                conn.CallService("InsertDesktopModule", new Envelope(new XStringHolder(req)));

                MessageBox.Show("安裝完成。");
                OnPrimaryKeyChanged(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvPlugin.SelectedRows.Count <= 0)
                {
                    return;
                }

                DialogResult dr = MessageBox.Show("確定要刪除選擇的項目?", "Campus", MessageBoxButtons.YesNo);
                if (dr == DialogResult.No)
                {
                    return;
                }

                PluginGridRow pg  = dgvPlugin.SelectedRows[0].DataBoundItem as PluginGridRow;
                XElement      req = new XElement("Request",
                                                 new XElement("Module",
                                                              new XElement("Condition",
                                                                           new XElement("ModuleUrl", pg.Url))));

                ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                conn.CallService("DeleteDesktopModule", new Envelope(new XHelper(req)));
                OnPrimaryKeyChanged(EventArgs.Empty);

                MessageBox.Show("項目已刪除!");
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
        private void AddUDM(ConnectionHelper conn, string url)
        {
            XElement req = new XElement("Request",
                new XElement("URL", url));

            conn.CallService("UDMService.ForceRegistry", new Envelope(new FISCA.XStringHolder(req)));
        }
Example #8
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = MessageBox.Show("確定要刪除選擇的 UDS?", "Campus", MessageBoxButtons.YesNo);
                if (dr == DialogResult.No)
                {
                    return;
                }

                XElement req = new XElement("Request");
                foreach (DataGridViewRow row in dgvUDS.SelectedRows)
                {
                    string name = row.Cells["chName"].Value + "";
                    req.Add(new XElement("ContractName", name));
                }

                if (req.Elements().Count() > 0)
                {
                    ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                    conn.CallService("UDSManagerService.DeleteContracts", new Envelope(new XHelper(req)));
                    OnPrimaryKeyChanged(EventArgs.Empty);

                    MessageBox.Show("UDS Contract 已刪除!");
                }
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #9
0
        private void buttonItem1_Click(object sender, EventArgs e)
        {
            if (dgvUDM.SelectedRows.Count < 0)
            {
                return;
            }

            DataGridViewRow row    = dgvUDM.SelectedRows[0];
            UDMGridRow      udmrow = (row.DataBoundItem as UDMGridRow);

            XElement req = new XElement("Request", new XElement("ModuleName", udmrow.Name));

            try
            {
                ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);
                conn.CallService("UDMService.UpdateModule", new Envelope(new XStringHolder(req)));

                MessageBox.Show("更新完成。");
                OnPrimaryKeyChanged(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #10
0
        private void AddUDM(ConnectionHelper conn, string url)
        {
            XElement req = new XElement("Request",
                                        new XElement("URL", url));

            conn.CallService("UDMService.ForceRegistry", new Envelope(new FISCA.XStringHolder(req)));
        }
Example #11
0
        protected override void OnPrimaryKeyChangedAsync()
        {
            ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);

            Envelope rsp = conn.CallService("SelectDesktopModule", new Envelope());

            Plugin = XElement.Parse(rsp.BodyContent.XmlString);
        }
Example #12
0
        protected override void OnPrimaryKeyChangedAsync()
        {
            ConnectionHelper conn   = ConnectionHelper.GetConnection(PrimaryKey);
            Envelope         rsp    = conn.CallService("SelectWebPackage", new Envelope());
            XElement         rspxml = XElement.Parse(rsp.BodyContent.XmlString);

            PackagesData = rspxml;
        }
Example #13
0
        protected override void OnPrimaryKeyChangedAsync()
        {
            ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);

            Envelope rsp = conn.CallService("UDSManagerService.ListContracts", new Envelope());

            UDS = XElement.Parse(rsp.BodyContent.XmlString);
        }
Example #14
0
        protected override void OnPrimaryKeyChangedAsync()
        {
            ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);

            Envelope rsp = conn.CallService("UDTService.DDL.ListTableNames", new Envelope());

            UDT = XElement.Parse(rsp.BodyContent.XmlString);
        }
Example #15
0
        private void RemoveDesktopModule(ConnectionHelper conn, string xurl)
        {
            XElement req = new XElement("Request",
                                        new XElement("Module",
                                                     new XElement("Condition",
                                                                  new XElement("ModuleUrl", xurl))));

            conn.CallService("DeleteDesktopModule", new Envelope(new XHelper(req)));
        }
Example #16
0
        private void LoadModuleConfig(ConnectionHelper conn)
        {
            Envelope rsp  = conn.CallService("SelectDesktopModule", new Envelope());
            XElement conf = XElement.Parse(rsp.BodyContent.XmlString);

            lock (ModuleConfigs)
            {
                ModuleConfigs[conn.UID] = new ModulesOfSchool(conf, conn.UID);
            }
        }
        protected override void OnPrimaryKeyChangedAsync()
        {
            ConnectionHelper ch = ConnectionHelper.GetConnection(PrimaryKey);

            string sql = "select uid,studentname \"name\",transfertoken token,status,transfertarget target from $st_transferout order by last_update desc";

            XElement req = new XElement("Request",
                                        new XElement("SQL", sql));

            Envelope rsp = ch.CallService("UDTService.DML.Query", new Envelope(new XStringHolder(req)));

            Data = XElement.Parse(rsp.BodyContent.XmlString);
        }
Example #18
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = false;
            dialog.Filter      = "UDT 定議 (*.tsml;*.tml)|*.tsml;*.tml";

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);

                    XElement udsdef = XElement.Load(dialog.FileName);

                    if (dialog.FileName.EndsWith(".tsml", StringComparison.InvariantCultureIgnoreCase))
                    {
                        conn.CallService("UDTService.DDL.SetTables", new Envelope(new XStringHolder(udsdef.ToString())));
                    }
                    else if (dialog.FileName.EndsWith(".tml", StringComparison.InvariantCultureIgnoreCase))
                    {
                        conn.CallService("UDTService.DDL.SetTable", new Envelope(new XStringHolder(udsdef.ToString())));
                    }
                    else
                    {
                        throw new ArgumentException("不支援的格式!");
                    }

                    MessageBox.Show("安裝/更新 UDT 完成。");
                    OnPrimaryKeyChanged(EventArgs.Empty);
                }
                catch (Exception ex)
                {
                    RTOut.WriteError(ex);
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #19
0
        private void AddDesktopModule(ConnectionHelper conn, string url)
        {
            XElement req = new XElement("Request",
                                        new XElement("Module",
                                                     new XElement("Field",
                                                                  new XElement("ModuleUrl", url),
                                                                  new XElement("Type", "FiscaAEModule"),
                                                                  new XElement("Memo", "集中安裝"),
                                                                  new XElement("Config",
                                                                               new XElement("Content",
                                                                                            new XElement("VersionOption", "Stable"))))));

            conn.CallService("InsertDesktopModule", new Envelope(new FISCA.XStringHolder(req)));
        }
        private void AddDesktopModule(ConnectionHelper conn, string url)
        {
            XElement req = new XElement("Request",
                new XElement("Module",
                    new XElement("Field",
                        new XElement("ModuleUrl", url),
                        new XElement("Type", "FiscaAEModule"),
                        new XElement("Memo", "集中安裝"),
                        new XElement("Config",
                            new XElement("Content",
                                new XElement("VersionOption", "Stable"))))));

            conn.CallService("InsertDesktopModule", new Envelope(new FISCA.XStringHolder(req)));
        }
Example #21
0
        private void CheckUDMNewVersion(UDMGridRow s)
        {
            ConnectionHelper conn = ConnectionHelper.GetConnection(PrimaryKey);

            XElement req = new XElement("Request", new XElement("ModuleName", s.Name));

            Envelope rsp       = conn.CallService("UDMService.CheckUpdate", new Envelope(new XStringHolder(req)));
            XElement rspxml    = XElement.Parse(rsp.BodyContent.XmlString);
            bool     hasUpdate = rspxml.ElementBool("HasUpdate", false);

            if (hasUpdate)
            {
                s.Version = s.RawData.ElementText("Version") + "*";
            }
        }
Example #22
0
        private static void MatchUDM(List <string> matchs, string pattern, object x)
        {
            object[]         args = x as object[];
            string           uidx = (string)args[0];
            ConnectionHelper chx  = args[1] as ConnectionHelper;

            Envelope rsp = chx.CallService("UDMService.ListModules", new Envelope());

            if (rsp.BodyContent.XmlString.IndexOf(pattern) >= 0)
            {
                lock (matchs)
                {
                    matchs.Add(uidx);
                }
            }
        }
Example #23
0
        private void SaveGadget(GadgetPackageRecord record)
        {
            try
            {
                ConnectionHelper ch = ConnectionHelper.GetConnection(PrimaryKey);

                XElement req = new XElement("Request",
                                            new XElement("Package",
                                                         new XElement("Field", record.Definition),
                                                         new XElement("Condition",
                                                                      new XElement("Uid", record.UID))));

                ch.CallService("UpdateWebPackage", new Envelope(new XStringHolder(req)));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #24
0
        private void UDTTableDefContent_Load(object sender, EventArgs e)
        {
            try
            {
                ConnectionHelper ch = ConnectionHelper.GetConnection(UID);

                XElement tn = new XElement("Request");
                tn.Add(new XElement("TableName", TableName));

                Envelope rsp = ch.CallService("UDTService.DDL.GetTableInfo", new Envelope(new XHelper(tn)));

                XElement rspxml = XElement.Parse(rsp.BodyContent.XmlString);
                editor.Text = rspxml.ToString();
            }
            catch (Exception ex)
            {
                RTOut.WriteError(ex);
                MessageBox.Show(ex.Message);
            }
        }
        private void btnReset_Click(object sender, EventArgs e)
        {
            try
            {
                ConnectionHelper ch = ConnectionHelper.GetConnection(PrimaryKey);

                DataGridViewRow row = dgvTransfers.SelectedRows[0];
                string          uid = row.Tag.ToString();

                string sql = "update $st_transferout set status='1', transfertarget=null,accepttoken=null where uid='" + uid + "';";

                XElement req = new XElement("Request",
                                            new XElement("Command", sql));

                Envelope rsp = ch.CallService("UDTService.DML.Command", new Envelope(new XStringHolder(req)));

                OnPrimaryKeyChanged(EventArgs.Empty);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void RemoveDesktopModule(ConnectionHelper conn, string xurl)
        {
            XElement req = new XElement("Request",
                new XElement("Module",
                  new XElement("Condition",
                      new XElement("ModuleUrl", xurl))));

            conn.CallService("DeleteDesktopModule", new Envelope(new XHelper(req)));
        }
        private void LoadModuleConfig(ConnectionHelper conn)
        {
            Envelope rsp = conn.CallService("SelectDesktopModule", new Envelope());
            XElement conf = XElement.Parse(rsp.BodyContent.XmlString);

            lock (ModuleConfigs)
            {
                ModuleConfigs[conn.UID] = new ModulesOfSchool(conf, conn.UID);
            }
        }
        private void UpdateUDM(ConnectionHelper conn, string name)
        {
            XElement req = new XElement("Request",
                new XElement("ModuleName", name));

            conn.CallService("UDMService.UpdateModule", new Envelope(new XHelper(req)));
        }