Ejemplo n.º 1
0
        public int UpdateUserGroup(string userToken, SysParameterDataSet sysParameter,
                                   List <string> rights)
        {
            try
            {
                string rightString = string.Empty;
                foreach (string s in rights)
                {
                    if (rightString == string.Empty)
                    {
                        rightString = s;
                    }
                    else
                    {
                        rightString = rightString + "," + s;
                    }
                }

                logger.Log(Level.INFO,
                           "Entering {0}. userToken={1}. name={2}. description={2}. id={3}"
                           , "UpdateUserGroup"
                           , userToken
                           , sysParameter.SysParameter[0].Name
                           , sysParameter.SysParameter[0].Description
                           , sysParameter.SysParameter[0].Id);

                int result = dataProvider.UpdateUserGroup(userToken, sysParameter);
                logger.Log(Level.INFO, "Exiting {0}"
                           , "UpdateUserGroup");
                return(result);
            }
            catch (ArgumentNullException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "ArgumentNullException"
                           , ex);
                throw new ArgumentNullException(ex.ParamName, ex.InnerException);
            }
            catch (InvalidUserTokenException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "InvalidUserTokenException"
                           , ex);
                throw new InvalidUserTokenException(ex.Message, userToken, ex.InnerException);
            }
            catch (ExpiredUserTokenException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "ExpiredUserTokenException"
                           , ex);
                throw new ExpiredUserTokenException(ex.Message, userToken, ex.InnerException);
            }
            catch (OperationFailedException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "OperationFailedException"
                           , ex);
                throw new OperationFailedException(ex.Message, userToken, ex.InnerException);
            }
        }
        public override global::System.Data.DataSet Clone()
        {
            SysParameterDataSet cln = ((SysParameterDataSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SysParameterDataSet ds = new SysParameterDataSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Ejemplo n.º 4
0
        protected void btnSaveEventCoordinator_OnClick(object sender, EventArgs e)
        {
            SysParameterDataSet sysParamDS = new SysParameterDataSet();

            sysParamDS.SysParameter.AddSysParameterRow(Utilities.editId,txtName.Text,txtEmail.Text,chkActive.Checked);

            if (Utilities.editId != -1)
            {
                
                    int result = dataProvider.UpdateEventCoordinator(Utilities.userToken, sysParamDS, eventId);

                    if (result != -1)
                    {
                        SetToast("success", "Event Coordinator has been succesfully updated");
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender, e);
                    }
                    else
                    {
                        SetToast("error", "An Event Coordinator with that email already exists!.");
                    }
               
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvEventCoordinator, txtEmail.Text))
                {
                    int result = dataProvider.AddEventCoordinator(Utilities.userToken, sysParamDS, eventId);

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        SetToast("success", "Event Coordinator was created successfully.");
                        btnCloseModal_OnClick(sender, e);
                    }
                    else
                    {
                        SetToast("error", "Event Coordinator exists already!");
                    }


                }
                else
                {
                    SetToast("info", "An Event Coordinator with that email already exists!");
                }

                DisplayEventCoordinatorsInGrid();
            }

            DisplayEventCoordinatorsInGrid();
        }
Ejemplo n.º 5
0
        protected void btnSaveEventCoordinator_OnClick(object sender, EventArgs e)
        {
            SysParameterDataSet sysParamDS = new SysParameterDataSet();

            sysParamDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtEmail.Text, chkActive.Checked);

            if (Utilities.editId != -1)
            {
                int result = dataProvider.UpdateEventCoordinator(Utilities.userToken, sysParamDS, eventId);

                if (result != -1)
                {
                    SetToast("success", "Event Coordinator has been succesfully updated");
                    Utilities.editId = -1;
                    btnCloseModal_OnClick(sender, e);
                }
                else
                {
                    SetToast("error", "An Event Coordinator with that email already exists!.");
                }
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvEventCoordinator, txtEmail.Text))
                {
                    int result = dataProvider.AddEventCoordinator(Utilities.userToken, sysParamDS, eventId);

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        SetToast("success", "Event Coordinator was created successfully.");
                        btnCloseModal_OnClick(sender, e);
                    }
                    else
                    {
                        SetToast("error", "Event Coordinator exists already!");
                    }
                }
                else
                {
                    SetToast("info", "An Event Coordinator with that email already exists!");
                }

                DisplayEventCoordinatorsInGrid();
            }

            DisplayEventCoordinatorsInGrid();
        }
Ejemplo n.º 6
0
        protected void btnSaveInterest_OnClick(object sender, EventArgs e)
        {
            var intDS = new SysParameterDataSet();

            intDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                                                  chkActive.Checked);

            if (Utilities.editId != -1)
            {
                int result = dataProvider.UpdateInterest(userToken, intDS);

                if (result != -1)
                {
                    Utilities.editId = -1;
                    btnCloseModal_OnClick(sender, e);
                    SetToast("success", "Interest updated succesfully.");
                }
                else
                {
                    SetToast("error", "An Interest with that name exists already.");
                }
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvInterests, txtName.Text))
                {
                    int result = dataProvider.AddInterest(userToken, intDS);

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender, e);
                        SetToast("success", "Interest created succesfully.");
                    }
                    else
                    {
                        SetToast("error", "An error occured, try again.");
                    }
                }
                else
                {
                    SetToast("info", "Interest exists already");
                }
            }

            DisplayInterestsInGrid();
        }
Ejemplo n.º 7
0
        protected void btnSaveCategory_OnClick(object sender, EventArgs e)
        {
            var catDS = new SysParameterDataSet();
            catDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                chkActive.Checked);

            if (Utilities.editId != -1)
            {

                int result = dataProvider.UpdateCategory(userToken, catDS,bool.Parse(cbTypes.SelectedValue));

                if (result != -1)
                {
                    Utilities.editId = -1;
                    btnCloseModal_OnClick(sender,e);
                    SetToast("success","Category updated succesfully.");
                }
                else
                {
                    SetToast("error","A category with that name exists already.");
                }
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvCategories, txtName.Text))
                {
                    int result = dataProvider.AddCategory(userToken, catDS, bool.Parse(cbTypes.SelectedValue));

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender,e);
                        SetToast("success","Category created succesfully.");
                    }
                    else
                    {
                        SetToast("error","An error occured, try again.");
                    }
                }
                else
                {
                    SetToast("info","Category exists already");
                }
            }

            DisplayCategoriesInGrid();
        }
Ejemplo n.º 8
0
        protected void btnSaveCategory_OnClick(object sender, EventArgs e)
        {
            var catDS = new SysParameterDataSet();

            catDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                                                  chkActive.Checked);

            if (Utilities.editId != -1)
            {
                int result = dataProvider.UpdateCategory(userToken, catDS, bool.Parse(cbTypes.SelectedValue));

                if (result != -1)
                {
                    Utilities.editId = -1;
                    btnCloseModal_OnClick(sender, e);
                    SetToast("success", "Category updated succesfully.");
                }
                else
                {
                    SetToast("error", "A category with that name exists already.");
                }
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvCategories, txtName.Text))
                {
                    int result = dataProvider.AddCategory(userToken, catDS, bool.Parse(cbTypes.SelectedValue));

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender, e);
                        SetToast("success", "Category created succesfully.");
                    }
                    else
                    {
                        SetToast("error", "An error occured, try again.");
                    }
                }
                else
                {
                    SetToast("info", "Category exists already");
                }
            }

            DisplayCategoriesInGrid();
        }
Ejemplo n.º 9
0
        protected void btnSaveInterest_OnClick(object sender, EventArgs e)
        {
            var intDS = new SysParameterDataSet();
            intDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                chkActive.Checked);

            if (Utilities.editId != -1)
            {

                int result = dataProvider.UpdateInterest(userToken, intDS);

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender, e);
                        SetToast("success", "Interest updated succesfully.");
                    }
                    else
                    {
                        SetToast("error", "An Interest with that name exists already.");
                    }
            }
            else
            {
                if (!Utilities.CheckGridForText(dgvInterests, txtName.Text))
                {
                    int result = dataProvider.AddInterest(userToken, intDS);

                    if (result != -1)
                    {
                        Utilities.editId = -1;
                        btnCloseModal_OnClick(sender,e);
                        SetToast("success", "Interest created succesfully.");
                    }
                    else
                    {
                        SetToast("error", "An error occured, try again.");
                    }
                }
                else
                {
                    SetToast("info", "Interest exists already");
                }
            }

            DisplayInterestsInGrid();
        }
Ejemplo n.º 10
0
        protected void dgvEventCoordinators_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (dgvEventCoordinator.Rows[e.RowIndex].Cells[3].Text != "False")
            {
                Utilities.editId = int.Parse(dgvEventCoordinator.DataKeys[e.RowIndex].Value.ToString());
                SysParameterDataSet sysDS = new SysParameterDataSet();
                string _name  = dgvEventCoordinator.Rows[e.RowIndex].Cells[1].Text;
                String _email = dgvEventCoordinator.Rows[e.RowIndex].Cells[2].Text;
                sysDS.SysParameter.AddSysParameterRow(Utilities.editId, _name, _email, false);

                dataProvider.UpdateEventCoordinator(userToken, sysDS, eventId);
                SetToast("success", "Event Coordinator deactivated succesfully");
            }
            else
            {
                SetToast("info", "Event Coordinator already deactivated");
            }
            DisplayEventCoordinatorsInGrid();
        }
Ejemplo n.º 11
0
 public SysParameterDataSet GetAllUserGroups(string userToken, int orgId)
 {
     try
     {
         logger.Log(Level.INFO,
                    "Entering {0}. userToken={1}. orgId={2}."
                    , "GetAllUserGroups"
                    , userToken
                    , orgId.ToString());
         SysParameterDataSet result = dataProvider.GetAllUserGroups(userToken, orgId);
         logger.Log(Level.INFO, "Exiting {0}"
                    , "GetAllUserGroups");
         return(result);
     }
     catch (ArgumentNullException ex)
     {
         logger.Log(Level.ERROR, "Exception thrown in GetAllUserGroups. Exception={0}. Message: {1}."
                    , "ArgumentNullException"
                    , ex);
         throw new ArgumentNullException(ex.ParamName, ex.InnerException);
     }
     catch (InvalidUserTokenException ex)
     {
         logger.Log(Level.ERROR, "Exception thrown in GetAllUserGroups. Exception={0}. Message: {1}."
                    , "InvalidUserTokenException"
                    , ex);
         throw new InvalidUserTokenException(ex.Message, userToken, ex.InnerException);
     }
     catch (ExpiredUserTokenException ex)
     {
         logger.Log(Level.ERROR, "Exception thrown in GetAllUserGroups. Exception={0}. Message: {1}."
                    , "ExpiredUserTokenException"
                    , ex);
         throw new ExpiredUserTokenException(ex.Message, userToken, ex.InnerException);
     }
     catch (OperationFailedException ex)
     {
         logger.Log(Level.ERROR, "Exception thrown in GetAllUserGroups. Exception={0}. Message: {1}."
                    , "OperationFailedException"
                    , ex);
         throw new OperationFailedException(ex.Message, userToken, ex.InnerException);
     }
 }
Ejemplo n.º 12
0
        protected void dgvInterests_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (dgvInterests.Rows[e.RowIndex].Cells[3].Text != "False")
            {
                Utilities.editId = int.Parse(dgvInterests.DataKeys[e.RowIndex].Value.ToString());
                string name = dgvInterests.Rows[e.RowIndex].Cells[1].Text;
                string desc = dgvInterests.Rows[e.RowIndex].Cells[2].Text;

                var intDS = new SysParameterDataSet();
                intDS.SysParameter.AddSysParameterRow(Utilities.editId, name, desc, false);
                dataProvider.UpdateInterest(userToken, intDS);

                SetToast("success", "Interest deactivated succesfully");
            }
            else
            {
                SetToast("info", "Interest already deactivated");
            }
            DisplayInterestsInGrid();
        }
Ejemplo n.º 13
0
        protected void btnSaveUserGroup_OnClick(object sender, EventArgs e)
        {
            if (Utilities.editId == -1)
            {
                var userGroupDS = new SysParameterDataSet();
                userGroupDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                                                            chkActive.Checked);

                List <string> list = new List <string>();

                if (Utilities.CheckGridForText(dgvUserGroups, txtName.Text) && Utilities.editId == -1)
                {
                    SetToast("info", "User group exists already.");
                    return;
                }
                else
                {
                    try
                    {
                        Utilities.editId = dataProvider.AddUserGroup(userToken, userGroupDS, list, orgId);
                    }
                    catch (Exception ex)
                    {
                        SetToast("error", "An error occured, try again.");
                    }
                }
            }

            var userGroupDS2 = new SysParameterDataSet();

            userGroupDS2.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                                                         chkActive.Checked);

            Session["userGroupParams"] = userGroupDS2;
            Utilities.pageName         = "btnManageUserGroups";
            Utilities.editId           = -1;
            Response.Redirect("/Users/UserGroupOperations.aspx");
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utilities.pageName = "btnManageUserGroups";
            removeInjectedScript();

            if (Session["userGroupParams"] == null)
            {
                Response.Redirect("/LandingPage.aspx");
            }
            else
            {
                userGroupParams = (SysParameterDataSet)Session["userGroupParams"];
                userGroup.Text = "to '" + userGroupParams.SysParameter[0].Name + "'";
                userGroupId_edit = userGroupParams.SysParameter[0].Id;
            }

            if (!IsPostBack)
            {
               
                LoadOperationsCB();
            }
            DisplayOperationsInGrid();
            
        }
Ejemplo n.º 15
0
        protected void dgvEventCoordinators_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {

            if (dgvEventCoordinator.Rows[e.RowIndex].Cells[3].Text != "False")
            {
                Utilities.editId = int.Parse(dgvEventCoordinator.DataKeys[e.RowIndex].Value.ToString());
                SysParameterDataSet sysDS = new SysParameterDataSet();
                string _name = dgvEventCoordinator.Rows[e.RowIndex].Cells[1].Text;
                String _email = dgvEventCoordinator.Rows[e.RowIndex].Cells[2].Text;
                sysDS.SysParameter.AddSysParameterRow(Utilities.editId,_name ,_email,false);

                dataProvider.UpdateEventCoordinator(userToken, sysDS, eventId);
                SetToast("success", "Event Coordinator deactivated succesfully");
            }
            else
            {
                SetToast("info", "Event Coordinator already deactivated");
            }
            DisplayEventCoordinatorsInGrid();
        }
Ejemplo n.º 16
0
        protected void dgvInterests_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (dgvInterests.Rows[e.RowIndex].Cells[3].Text != "False")
            {
                Utilities.editId = int.Parse(dgvInterests.DataKeys[e.RowIndex].Value.ToString());
                string name = dgvInterests.Rows[e.RowIndex].Cells[1].Text;
                string desc = dgvInterests.Rows[e.RowIndex].Cells[2].Text;
                
                var intDS = new SysParameterDataSet();
                intDS.SysParameter.AddSysParameterRow(Utilities.editId, name, desc,false);
                dataProvider.UpdateInterest(userToken,intDS);

                SetToast("success", "Interest deactivated succesfully");
            }
            else
            {
                SetToast("info", "Interest already deactivated");
            }
            DisplayInterestsInGrid();
        }
Ejemplo n.º 17
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     SysParameterDataSet ds = new SysParameterDataSet();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "SysParameterDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                SysParameterDataSet ds = new SysParameterDataSet();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "SysParameterDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Ejemplo n.º 19
0
        public int AddInterest(string userToken, SysParameterDataSet intDS)
        {
            int newId = -1;

            if (IsUserTokenValid(userToken))
            {
                try
                {
                    conn.Open();
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "spAddInterest";

                    var p2 = new SqlParameter[4];

                    for (int i = 0; i < 4; i++)
                        p2[i] = new SqlParameter();


                    p2[0] = new SqlParameter("name", intDS.SysParameter[0].Name);
                    p2[1] = new SqlParameter("description", intDS.SysParameter[0].Description);
                    p2[2] = new SqlParameter("active", intDS.SysParameter[0].Active);
                    p2[3] = new SqlParameter("updateUser", _userId);

                    cmd.Parameters.AddRange(p2);

                    newId = int.Parse(cmd.ExecuteScalar().ToString());
                }
                catch (Exception ex)
                {
                    throw new OperationFailedException(ex.Message, ex);
                }
                finally
                {
                    if (conn.State != ConnectionState.Closed)
                    {
                        conn.Close();
                    }
                }
            }
            return newId;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Creates a user group and saves it in the database
        /// </summary>
        /// <param name="userToken">The userToken of the user performing the request</param>
        /// <param name="sysParameter">The system parameter to be added</param>
        /// <param name="rights">The list of authorised accesses the user has</param>
        /// <returns>An integer whih is the id of the newly created user</returns>
        public int UpdateUserGroup(string userToken,SysParameterDataSet sysParameter)
        {
            int newId = -1;
            if (IsUserTokenValid(userToken))
            {
                try
                {
                    conn.Open();
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "spUpdateUserGroup";

                    var p2 = new SqlParameter[6];
                    for (int i = 0; i < 6; i++)
                        p2[i] = new SqlParameter();

                    p2[0] = new SqlParameter("id", sysParameter.SysParameter[0].Id);
                    p2[1] = new SqlParameter("name", sysParameter.SysParameter[0].Name);
                    p2[2] = new SqlParameter("description", sysParameter.SysParameter[0].Description);
                    p2[3] = new SqlParameter("active", sysParameter.SysParameter[0].Active);
                    p2[4] = new SqlParameter("updateUser", _userId);
                    p2[5] = new SqlParameter("orgId", Utilities.companyId);

                    cmd.Parameters.AddRange(p2);

                    newId = int.Parse(cmd.ExecuteScalar().ToString());

                    if(newId != -1)
                    {
                        if (conn.State != ConnectionState.Closed)
                        {
                            conn.Close();
                        }
                        //SetRightsForUserGroup(newId, rights);
                    }


                }
                catch (Exception ex)
                {
                    throw new OperationFailedException(ex.Message, ex);
                }
                finally
                {
                    if (conn.State != System.Data.ConnectionState.Closed)
                    {
                        conn.Close();
                    }
                }
            }
            return newId;
        }
Ejemplo n.º 21
0
        public SysParameterDataSet GetActiveInterests(string userToken)
        {

            var retDataset = new SysParameterDataSet();

            if (IsUserTokenValid(userToken))
            {
                try
                {
                    conn.Open();
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "spGetActiveInterests";

                    
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            var catDS = retDataset.SysParameter.NewSysParameterRow();

                            catDS.Id = int.Parse(reader["Id"].ToString());
                            catDS.Name = reader["Name"].ToString();
                            catDS.Description = reader["Description"].ToString();
                            catDS.Active = bool.Parse(reader["Active"].ToString());

                            retDataset.SysParameter.AddSysParameterRow(catDS);
                        }
                        reader.Close();
                    }

                }
                catch (Exception ex)
                {
                    throw new OperationFailedException(ex.Message, ex);
                }
                finally
                {
                    if (conn.State != System.Data.ConnectionState.Closed)
                    {
                        conn.Close();
                    }
                }
            }

            return retDataset;
        }
Ejemplo n.º 22
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     SysParameterDataSet ds = new SysParameterDataSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Ejemplo n.º 23
0
        public int UpdateEventCoordinator(string userToken, SysParameterDataSet sysParameter, int eventId)
        {
            int newId = -1;
            if (IsUserTokenValid(userToken))
            {
                try
                {
                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "spUpdateEventCoordinator";

                    var p2 = new SqlParameter[6];
                    for (int i = 0; i < 6; i++)
                        p2[i] = new SqlParameter();

                    p2[1] = new SqlParameter("name", sysParameter.SysParameter[0].Name);
                    p2[2] = new SqlParameter("email", sysParameter.SysParameter[0].Description);
                    p2[3] = new SqlParameter("active", sysParameter.SysParameter[0].Active);
                    p2[4] = new SqlParameter("updateUser", _userId);
                    p2[5] = new SqlParameter("eventId",eventId);
                    p2[0] = new SqlParameter("id", sysParameter.SysParameter[0].Id);

                    cmd.Parameters.AddRange(p2);

                    newId = int.Parse(cmd.ExecuteScalar().ToString());

                }
                catch (Exception ex)
                {
                    throw new OperationFailedException(ex.Message, ex);
                }
                finally
                {
                    if (conn.State != System.Data.ConnectionState.Closed)
                    {
                        conn.Close();
                    }
                }
            }
            return newId;
        }
Ejemplo n.º 24
0
        protected void btnSaveUserGroup_OnClick(object sender, EventArgs e)
        {
            if (Utilities.editId == -1)
            {
               var userGroupDS = new SysParameterDataSet();
                    userGroupDS.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                        chkActive.Checked);

                List<string> list = new List<string>();
                
                if (Utilities.CheckGridForText(dgvUserGroups, txtName.Text) && Utilities.editId == -1)
                {
                    SetToast("info", "User group exists already.");
                    return;
                }
                else
                {
                    try
                    {
                        Utilities.editId = dataProvider.AddUserGroup(userToken, userGroupDS, list, orgId);
                    }
                    catch (Exception ex)
                    {
                        SetToast("error","An error occured, try again.");
                    }
                    
                }
                
            }

            var userGroupDS2 = new SysParameterDataSet();
                userGroupDS2.SysParameter.AddSysParameterRow(Utilities.editId, txtName.Text, txtDescription.InnerText,
                    chkActive.Checked);

                Session["userGroupParams"] = userGroupDS2;
                Utilities.pageName = "btnManageUserGroups";
                Utilities.editId = -1;
                Response.Redirect("/Users/UserGroupOperations.aspx");

            
        }
Ejemplo n.º 25
0
        public SysParameterDataSet GetEventCoordinatorsByEventId(string userToken, int eventId)
        {

            var retDataset = new SysParameterDataSet();

            if (IsUserTokenValid(userToken))
            {
                try
                {
                    if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); }
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "spGetEventCoordinatorsByEventId";

                    var p = new SqlParameter("eventId", eventId);

                    cmd.Parameters.Add(p);

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            var sysParam = retDataset.SysParameter.NewSysParameterRow();

                            sysParam.Id = int.Parse(reader["Id"].ToString());
                            sysParam.Name = reader["Name"].ToString();
                            sysParam.Description = reader["Email"].ToString();
                            sysParam.Active = (bool)reader["Active"];


                            retDataset.SysParameter.AddSysParameterRow(sysParam);
                        }
                        reader.Close();
                    }

                }
                catch (Exception ex)
                {
                    throw new OperationFailedException(ex.Message, ex);
                }
                finally
                {
                    if (conn.State != System.Data.ConnectionState.Closed)
                    {
                        conn.Close();
                    }
                }
            }
            return retDataset;
        }
Ejemplo n.º 26
0
        public int UpdateUserGroup(string userToken, SysParameterDataSet sysParameter,
                              List<string> rights)
        {
            try
            {
                string rightString = string.Empty;
                foreach (string s in rights)
                {
                    if (rightString == string.Empty)
                    {
                        rightString = s;
                    }
                    else
                    {
                        rightString = rightString + "," + s;
                    }
                }

                logger.Log(Level.INFO,
                           "Entering {0}. userToken={1}. name={2}. description={2}. id={3}"
                           , "UpdateUserGroup"
                           , userToken
                           , sysParameter.SysParameter[0].Name
                           , sysParameter.SysParameter[0].Description
                           , sysParameter.SysParameter[0].Id);

                int result = dataProvider.UpdateUserGroup(userToken, sysParameter);
                logger.Log(Level.INFO, "Exiting {0}"
                           , "UpdateUserGroup");
                return result;
            }
            catch (ArgumentNullException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "ArgumentNullException"
                           , ex);
                throw new ArgumentNullException(ex.ParamName, ex.InnerException);
            }
            catch (InvalidUserTokenException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "InvalidUserTokenException"
                           , ex);
                throw new InvalidUserTokenException(ex.Message, userToken, ex.InnerException);
            }
            catch (ExpiredUserTokenException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "ExpiredUserTokenException"
                           , ex);
                throw new ExpiredUserTokenException(ex.Message, userToken, ex.InnerException);
            }
            catch (OperationFailedException ex)
            {
                logger.Log(Level.ERROR, "Exception thrown in UpdateUserGroup. Exception={0}. Message: {1}."
                           , "OperationFailedException"
                           , ex);
                throw new OperationFailedException(ex.Message, userToken, ex.InnerException);
            }
        }