示例#1
0
        private static void AssignInitialRolesForAllOperators()
        {
            XmlNode ops = null;
            string  msg = null;

            #region Get operators
            using (gjtEmrPatients.emrPatients ep = new gjtEmrPatients.emrPatients())
            {
                msg = ep.Getoperators(ref ops);
                if (msg != null)
                {
                    MessageBox.Show(msg, ErrorMessage.Error);
                    return;
                }
            }
            #endregion

            using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml())
            {
                XmlNode roles = null;
                msg = es.GetRolesForOneOperator(StringGeneral.supperUser, ref roles);
                if (msg != null)
                {
                    MessageBox.Show(msg, ErrorMessage.Error);
                    return;
                }
                /* If hi has been assigned as roles, initial can not be done again. */
                if (roles != null)
                {
                    return;
                }

                foreach (XmlNode op in ops)
                {
                    XmlElement roleid0 = op.OwnerDocument.CreateElement(ElementNames.RoleID);
                    roleid0.InnerText = "01";
                    op.AppendChild(roleid0);
                    XmlElement roleid1 = op.OwnerDocument.CreateElement(ElementNames.RoleID);
                    roleid1.InnerText = "03";
                    op.AppendChild(roleid1);
                    msg = es.SetOperatorRoles(op);
                    if (msg != null)
                    {
                        MessageBox.Show(msg, ErrorMessage.Error);
                        return;
                    }
                }
            }
        }