protected void Page_Load(object sender, System.EventArgs e)
        {
            permss = check_permissions(this.Page, true);
            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }
            exp = false;

            schdld.Visible = exp;
            //schNow.Visible = (!exp);
            content = Request.QueryString["content"];
            //if (!IsPostBack && content.Equals("new"))
            //{
            //    Response.Redirect("index.aspx");
            //}


            switch (content)
            {
                case "new":
                    Page_Load_new();
                    break;
                case "edit":
                    Page_Load_edit();
                    break;
            }
        }
Пример #2
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
            page_utilities.Set_titles(this, "Master Reports Now");
            permss = check_permissions(this.Page, true);
            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }

            index_MasterReport MasterrptNow = null;

            if (!IsPostBack)
            {
                if (Context.Handler.GetType().Name.Equals("datamgmt_index_masterreport_aspx"))
                {
                    if ((index_MasterReport)Context.Handler != null)
                    {
                        MasterrptNow = (index_MasterReport)Context.Handler;
                        tbreportname.Text = MasterrptNow.Masterrptname;
                        MaterRptId.Value =  Convert.ToString(MasterrptNow.MstrId);
                    }
                }
            }

		}
Пример #3
0
        public void TestSelectUsersByRoleTypeAndCountryPermissions()
        {
            string email = "*****@*****.**" + GetNewStamp();
            string login = "******" + GetNewStamp();
            string password = "******";
            bool isAdmin = false;
            UserType type = UserType.CountryUserWithDataAccess;
            UserCompanyType companytype = UserCompanyType.HPI;
            int Company_Code = 0;
            List<CountryDto> listOfPermittedCountriesQuestionnaire = CommonFacade.GetListOfCountries("'de','pl'");
            UserDto user = new UserDto(email, isAdmin, password, login, type, listOfPermittedCountriesQuestionnaire, null, Company_Code, companytype);
            Assert.IsTrue(UserFacade.CreateOrUpdate(user, "insert", null, null));                

            foreach (CountryDto country in listOfPermittedCountriesQuestionnaire)
            {
                Assert.IsTrue(UserFacade.CreateOrUpdate(user, "country", "q", country.Country));                
            }
            
            UserDto sel = AdminRegistry.UserDao.GetByLogin(login);
            Assert.IsNotNull(sel);
            Assert.AreEqual(user, sel);
            Assert.AreEqual(email, sel.EmailAddress);
            Assert.AreEqual(login, sel.Login);
            Assert.AreEqual(password, sel.Password);
            Assert.AreEqual(isAdmin, sel.IsAdmin);
            Assert.AreEqual(type, sel.UserType);
            
            List<UserDto> listOfUsers = AdminRegistry.UserDao.SelectUsersByRoleTypeAndCountryPermissions(Migration.ConvertUserTypeToString(type), "q", "de",2);
            Assert.IsTrue(listOfUsers.Find(u => u.Equals(sel)) != null);
            Assert.IsTrue(AdminRegistry.UserDao.Delete(user));
            Assert.IsNull(AdminRegistry.UserDao.GetByLogin(login));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     page_utilities.Set_titles(this, "Siebel Codes Report for single questionnaire/ processor");
     permss = check_permissions(this.Page, true);
     if (!IsPostBack)
     {
         InitializeErrorPanels();
         valid_qid_integer.ValidationExpression = constants.REGEX_INTEGER;
     }
 }
Пример #5
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			page_utilities.Set_titles(this.Page, "User administration");

			permss = check_permissions(this.Page, true);

			if (permss.UserType != UserType.Admin)
			{
				Response.Redirect("../index.aspx", true);
			}

			if (!this.IsPostBack)
            {
                #region Role bind

                roleList.DataSource = listOfRoles;
                roleList.DataBind();
                roleList.SelectedIndex = 0;

                #endregion 

                #region Permissions bind

                permissionsList.DataSource = listOfPermissions;
                permissionsList.DataBind();
                permissionsList.Items[0].Selected = true;
                permissionsList.Items[1].Selected = true;

                #endregion

                #region Country bind
                List<CountryDto> listOfCountries = new List<CountryDto>();
                listOfCountries.Add(new CountryDto()
                    {
                        Country = "--", 
                        CountryName = "- Show all -"
                    });
                List<CountryDto> temp = CommonFacade.GetListOfCountries(null);
                if (temp != null && temp.Count > 0)
                    listOfCountries.AddRange(temp);
				
				country_FK.DataSource = listOfCountries;
				country_FK.DataTextField ="CountryName";
				country_FK.DataValueField = "Country";
				country_FK.DataBind();
				country_FK.SelectedIndex = 0;
                #endregion 

                #region company              
                PopulateCompanyDDL();
                #endregion
            }
		}
        protected void Page_Load(object sender, EventArgs e)
        {                        
            if (Request.QueryString["content"] != "new" &&
                Request.QueryString["content"] != "edit")
            {
                Response.Redirect("index.aspx");
            }

            permss = check_permissions(this.Page, true);
            page_utilities.Set_titles(this.Page, "Pre-defined question");

            if (!IsPostBack)
            {
                otherPanel.Visible = false;
                InitializePanels();
                try
                {

                    if (Request.QueryString["content"] == "new")
                    {
                        PageLoad_New();
                    }
                    else
                    {
                        PageLoad_Edit();
                    }

                    if (Session["page_id"] != null)
                    {
                        page_id_from_session = int.Parse(Session["page_id"].ToString());
                    }
                    else if (pageQuestion != null)
                    {
                        page_id_from_session = pageQuestion.PageId;
                    }

                    if (Session["questionnaire_id"] != null)
                        questionnaire_id = int.Parse(Session["questionnaire_id"].ToString());
                    else if (Request.QueryString["qid"] != null)
                        questionnaire_id = int.Parse(Request.QueryString["qid"]);


                    LoadSortSequences();
                    LoadPredefinedQuestionData();
                    if (Request.QueryString["content"] == "edit")
                    {
                        LoadQuestion();
                    }
                }
                catch (Exception)
                {
                    Response.Redirect("index.aspx");
                }
            }
        }
Пример #7
0
        public bool CreateOrUpdate(UserDto user, string flag, string type, string country)
        {
            bool retval = false;
            DbCommand sp = null;
            DbConnection connection = null;
            IDataReader reader = null;
            try
            {
                connection = _dbLayer.GetConnection();
                sp = connection.CreateCommand();

                sp.CommandText = "update_user";
                sp.CommandType = CommandType.StoredProcedure;
                _dbLayer.AddParameter(sp, "@flag", ParameterDirection.Input, DbType.String, flag);
                _dbLayer.AddParameter(sp, "@useremail", ParameterDirection.Input, DbType.String, user.EmailAddress);
                _dbLayer.AddParameter(sp, "@ntlogin", ParameterDirection.Input, DbType.String, user.Login);
                _dbLayer.AddParameter(sp, "@adminrole", ParameterDirection.Input, DbType.Boolean, user.IsAdmin);
                _dbLayer.AddParameter(sp, "@password", ParameterDirection.Input, DbType.String, user.Password);
                _dbLayer.AddParameter(sp, "@role", ParameterDirection.Input, DbType.String, Migration.ConvertUserTypeToString(user.UserType));
                _dbLayer.AddParameter(sp, "@type", ParameterDirection.Input, DbType.String, type);
                _dbLayer.AddParameter(sp, "@country", ParameterDirection.Input, DbType.String, country);
                _dbLayer.AddParameter(sp, "@company_code", ParameterDirection.Input, DbType.Int32, user.Company_Code); //RFG 2.20--
                _dbLayer.AddReturnParameter(sp);
                sp.ExecuteNonQuery();
                retval = true;
            }
            catch (DbException e)
            {
                Trace.WriteLine("UserDao.Create(" + user + "): " + e.Message);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }

                if (sp != null)
                {
                    sp.Dispose();
                }

                if (connection != null)
                {
                    _dbLayer.ReturnConnection(connection);
                }
                else
                {
                    _dbLayer.ReturnConnection(connection, true);
                }
            }

            return retval;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here
            page_utilities.Set_titles(this, "Re-Assign User Artifacts Page");
            permss = check_permissions(this.Page, true);

            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect("../index.aspx", true);
            }

        }
Пример #9
0
		protected void Page_Load(object sender, System.EventArgs e)
		{            
            if (!checkforASTACompliance()) Response.Redirect("user_index.aspx", true);            
            permss = check_permissions(this.Page, true);

            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect("../index.aspx", true);
            }

            if (!IsPostBack)
            {
                if (!this.IsPostBack)
                {
                    List<CountryDto> countries = CommonFacade.GetListOfCountries(null);

                    existing_cc.DataSource = countries;
                    existing_cc.DataTextField = "CountryName";
                    existing_cc.DataValueField = "Country";
                    existing_cc.DataBind();

                    existing_cc_proc.DataSource = countries;
                    existing_cc_proc.DataTextField = "CountryName";
                    existing_cc_proc.DataValueField = "Country";
                    existing_cc_proc.DataBind();
                }
                PopulateCompanyDDL(); // RFG 2.20 to Populate the Company Dropdown;
            }

			if(Request.QueryString["content"] != null)
			{
                if (!IsPostBack)
                {
                    roleList.DataSource = listOfRoles;
                    roleList.DataBind();
                    roleList.SelectedIndex = 0;
                }

				switch(Request.QueryString["content"].ToString())
				{
					case "new": Page_Load_new();
						break;
					case "edit": Page_Load_edit();
						break;
					default:
						break;
				}               
			}
			else
			{
				Response.Redirect("user_index.aspx", true);
			}
		}
Пример #10
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			page_utilities.Set_titles(this, "Find questionnaire");
			permss = check_permissions(this.Page, true);

			tr_result.Visible = tr_error.Visible = validator_table.Visible = false;
			
			if(!this.IsPostBack)
			{
				valid_qid_integer.ValidationExpression = constants.REGEX_INTEGER;
			}
		}
Пример #11
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			permss = check_permissions(this.Page, true);

			// Put user code to initialize the page here
			
			/* string content_builder and session-variable pcc (=page_content_code) for switching
			between different contents (see Page_Load_<pcc>) to be displayed */
			string content_builder;
			if (Request.QueryString.GetValues("pcc") != null) 
			{
				content_builder = Request.QueryString.Get("pcc").ToString();
			}
			else
			{
				content_builder = "start";
			}

			//initialize page and make all elements invisible
			themeheaderTable.Visible=false;
			
			firstDataTable.Visible=false;
			secondDataTable.Visible=false;
			thirdDataTable.Visible=false;
			fourthDataTable.Visible=false;
			fifthDataTable.Visible=false;

			firstButtonTable.Visible=false;
			secondButtonTable.Visible=false;
			thirdButtonTable.Visible=false;
			fourthButtonTable.Visible=false;
            tblCreateNewTop.Visible = false;            //††† 20120301 Biju Pattathil | RFG2.6 New Top Button (Admin Only) Start†††

			//calling different Page_Load's according to content_builder (see above)
			switch (content_builder)
			{
				case "create_new_campaign": Page_Load_create_new_campaign(); 
					break;
				case "delete_campaign":		Page_Load_delete_campaign(); 
					break;
				case "delete_campaign_confirm": Page_Load_delete_campaign_confirm(); 
					break;
				case "delete_confirmation": Page_Load_delete_confirmation(); 
					break;
				default: Page_Load_start();
					break;
			}
		}
Пример #12
0
        /// <summary>
        /// Page_load method is called when first time page is calling
        /// </summary>
        /// <param name="sender">This will give sender informaion</param>
        /// <param name="e">This will give enent argument details</param>        
       protected void Page_Load(object sender, EventArgs e)
       {
           page_utilities.Set_titles(this, "HPP Field Management");

           permss = check_permissions(this.Page, true);
           if (permss.UserType != UserType.Admin)
           {
               Response.Redirect(utility.getParameter("UrlToApplication") + "index.aspx", true);
           }
            

            if (!this.IsPostBack)
            {
                this.LoadHppFields();
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            page_utilities.Set_titles(this, "Manage pre-defined questions");

            permss = check_permissions(this.Page, true);

            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect(utility.getParameter("UrlToApplication") + "index.aspx", true);
            }
            
            if (!IsPostBack)
            {
                LoadQuestions();
            }
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            page_utilities.Set_titles(this, "Edit Navigation Tabs");
			permss = check_permissions(this.Page, true);

            if (Session["page_id"] == null || Session["questionnaire_id"] == null)
            {                
                Response.Redirect("edit_page_overview.aspx?content=edit", true);
            }
            else
            {
                pageIdFromSession = Session["page_id"].ToString();
                questionnaireIdFromSession = Session["questionnaire_id"].ToString();                
            }            
                        
            try
            {
                PageAssemblyDto retval = QuestionnaireFacade.GetPageByPageId(Int64.Parse(questionnaireIdFromSession), int.Parse(pageIdFromSession), ViewType.Undefined, false);
                if (retval == null)
                {
                    Response.Redirect("edit_page_overview.aspx?content=edit", true);
                }
                formType = Migration.ConvertPageTypeToDisplayedString(retval.Page.PageType);
                page = retval.Page;
            }
            catch (UserCausedException)
            { }                        

            if (!IsPostBack)
            {
                int initialFormOrder = 1;
                listOfNavigationElements = new List<NavigationElementDto>();
                if (page.PageType != PageType.FormPage)
                {
                    initialFormOrder = PagePrefill();
                    addElementPanel.Visible = false;


                    delete_element.Enabled = false;
                    delete_element.Style.Add("readonly", "true");
                    delete_element.ToolTip = "In order to remove tab navigation, you need to delete that from formpage"; 
                }
                LoadListOfNavigationElements(page.PageType, initialFormOrder);
                InitializePanels();
            }
            
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            page_utilities.Set_titles(this, "Delete Campaign");
            permss = check_permissions(this.Page, true);            

            try
			{
                campaign_code = Session["campaign_code"].ToString();
			}
			catch
			{
				Response.Redirect("index.aspx", true);
			}

            campaign_definition.Text = String.Format("The campaign <b>{0}</b> " + "  is now empty and stores no additional [questionnaire | processor] any more. Do you also want to delete campaign <b>{0}</b> now?", campaign_code);
                
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            permss = check_permissions(this.Page, true);
            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect(utility.getParameter("UrlToApplication") + "index.aspx", true);
            }
            

            page_utilities.Set_titles(this.Page, "Localize Pre-Defined Question");
            if (!IsPostBack)
            {
                ResetAllFields();
                InitializeErrorsPanels();
                LoadPredefinedQuestions();
                LoadLocalizations();
            }
            Session["question_id"] = null;
        }
Пример #17
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			permss = check_permissions(this.Page, true);
            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }

			content = Request.QueryString["content"];

			switch (content)
			{
				case "new": 
					Page_Load_new();
					break;
				case "edit":
					Page_Load_edit();
					break;
			}
		}
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            page_utilities.Set_titles(this, "Edit Additional Navigation");
            permss = check_permissions(this.Page, true);

            if (Session["page_id"] == null || Session["questionnaire_id"] == null)
            {                
                Response.Redirect("edit_page_overview.aspx?content=edit", true);
            }
            else
            {
                pageIdFromSession = Session["page_id"].ToString();
                questionnaireIdFromSession = Session["questionnaire_id"].ToString();
            }

            try
            {
                PageAssemblyDto retval = QuestionnaireFacade.GetPageByPageId(Int64.Parse(questionnaireIdFromSession), int.Parse(pageIdFromSession), ViewType.Undefined, false);
                if (retval == null)
                {
                    Response.Redirect("edit_page_overview.aspx?content=edit", true);
                }
                formType = Migration.ConvertPageTypeToDisplayedString(retval.Page.PageType);
                page = retval.Page;
            }
            catch (UserCausedException)
            { }    

            if (!IsPostBack)
            {
                useFormpage = false;
                List<string> list = new List<string>(){ "Select element type", "Non - clickable headline", /*"Clickable headline",*/ "Link"/*, "Divider"*/ };                 
                elementTypeList.DataSource = list;
                elementTypeList.DataBind();
                ResetAddElement();
                listOfNavigationElements = new List<NavigationElementDto>();
                LoadListOfNavigationElements();
                InitializePanels();
                AdjustDeleteButtonVisibility();
            }            
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here
            page_utilities.Set_titles(this, "Re-Assign User Artifacts Page");
            permss = check_permissions(this.Page, true);

            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect("../index.aspx", true);
            }

            if (!IsPostBack)
            {
                txtSourceUser.Text = Session["reassign_email"].ToString();
                //††† 20120302 Biju Pattathil | RFG2.7 6021-Re-assign artifacts - page behaviour is not correct:Start†††
                optQuestionnaires.Checked = true;
                optartifact_Click(optQuestionnaires, e);
                //††† 20120302 Biju Pattathil | RFG2.7 6021-Re-assign artifacts - page behaviour is not correct:End†††
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            page_utilities.Set_titles(this.Page, "Export reports / statistics files");
            permss = check_permissions(this.Page, true);

            if (permss.UserType != UserType.Admin || 
                 Session["from"] == null ||
                Session["until"] == null ||
                Session["ordering"] == null||
                Session["row_number"] == null)
            {
                Response.Redirect("index.aspx", true);
            }

            table_emailerror.Visible = false;

            if (!IsPostBack)
            {
                try
                {
                    InitializeStatisticsValues();
                    pathtotempdir = Server.MapPath(utility.getParameter("path_to_temp"));

                    values = new statistics_values();
                    values.permss_account = permss.EmailAddress;
                    values.permss_user = permss.EmailAddress;
                    values.from = from;
                    values.until = until;
                    values.row_number = row_number;
                    values.ordering = ordering;
                    values.Company_Code = permss.Company_Code; //RFG 2.20
                }
                catch
                {
                    table_emailerror.Visible = true;
                }
                values.pathtotempdir = pathtotempdir;
                mailthread.generate_dataemail(values, true);
            }
        }
Пример #21
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			page_utilities.Set_titles(this, "Delete Processor");
			permss = check_permissions(this.Page, true);
	
			try
			{
				processor_id = Session["processor_id"].ToString();
			}
			catch
			{
				Response.Redirect("index.aspx", true);
			}

			Hashtable h_params = new Hashtable();
			h_params.Add("questionnaire_id", processor_id);
            h_params.Add("questionnaire_type", "p");

			DataTable processor = DB.execProc("select_questionnaire_general", h_params);


            if (processor.Rows.Count != 0)
			{
                campaign_code = processor.Rows[0]["campaign_code_FK"].ToString();
                campaign_definition.Text = String.Format("Campaign: <b>{0}</b>    ", processor.Rows[0]["campaign_code_FK"].ToString());
                campaign_definition.Text = String.Format("{0}Processor title: <b>{1}</b>    ", campaign_definition.Text, processor.Rows[0]["qid_title"].ToString());
                campaign_definition.Text = String.Format("{0} cc: <b>{1}</b>    ", campaign_definition.Text, processor.Rows[0]["country_FK"].ToString());
                campaign_definition.Text = String.Format("{0} ll: <b>{1}</b>    ", campaign_definition.Text, processor.Rows[0]["language_FK"].ToString());
                //mainimage_filename = questionnaire.Rows[0]["main_image"].ToString();
			}
			else
			{
				Response.Redirect("index.aspx", true);
			}

		}
Пример #22
0
        public void TestGetUserByEmailLoginPassword()
        {
            string email = "*****@*****.**" + GetNewStamp();
            string login = "******" + GetNewStamp();
            string password = "******";
            bool isAdmin = true;
            UserType type = UserType.Admin;
            UserCompanyType companytype = UserCompanyType.HPI;
            int Company = 0;
            UserDto user = new UserDto(email, isAdmin, password, login, type,Company,companytype);
            Assert.IsTrue(AdminRegistry.UserDao.CreateOrUpdate(user, "insert", null, null));
            UserDto sel = AdminRegistry.UserDao.GetUserByEmailLoginPassword(email, login, password);
            Assert.IsNotNull(sel);
            Assert.AreEqual(user, sel);
            Assert.AreEqual(email, sel.EmailAddress);
            Assert.AreEqual(login, sel.Login);
            Assert.AreEqual(password, sel.Password);
            Assert.AreEqual(isAdmin, sel.IsAdmin);
            Assert.AreEqual(type, sel.UserType);

            Assert.IsTrue(AdminRegistry.UserDao.Delete(user));
            Assert.IsNull(AdminRegistry.UserDao.GetByLogin(login));
        }
Пример #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["content"] == null ||
                !((Request.QueryString["content"] == "new") ||
                 (Request.QueryString["content"] == "edit")) ||
                (Request.QueryString["content"] == "edit" && 
                Session["question_id"] == null))
                Response.Redirect("index.aspx");

            permss = check_permissions(this.Page, true);
            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect(utility.getParameter("UrlToApplication") + "index.aspx", true);
            }
            

            switch (Request.QueryString["content"])
            { 
                case "new" :
                    Page_Load_New();
                    break;
                case "edit":
                    Page_Load_Edit();
                    break;
            }

            if (!IsPostBack)
            {                
                //bind ordering for new adding choice
                foreach (String order in orderingDropDownList)
                    ordering_add_dropdown.Items.Add(order);
                ordering_add_dropdown.DataBind();
                InitializeErrorsPanels();
                LoadHppList();
                LoadListOfChoices();
            }            
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["content"] != "new" &&
                Request.QueryString["content"] != "edit")
            {
                Response.Redirect("index.aspx");
            }

            permss = check_permissions(this.Page, true);
            page_utilities.Set_titles(this.Page, "Add pre-defined question");            
            if (!IsPostBack)
            {
                noContentChoosePanel.Visible = false;
                try
                {
                    questionnaire_id_from_session = int.Parse(Session["questionnaire_id"].ToString());
                }
                catch
                {
                    Response.Redirect("index.aspx", true);
                }
                LoadContent();                        
            }
        }
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			page_utilities.Set_titles(this, "Master Export Response Files - scheduled");	
			permss = check_permissions(this.Page, true);

            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }

			error_table.Visible = false;

			if (!this.IsPostBack)
			{
				Session.Clear();
				Session["permissions"] = permss;

				Hashtable h_params = new Hashtable();

                h_params.Add("isSchdld", 1);

                string allowed_countriesQ = "";
                string allowed_countriesP = "";

                if (permss.UserType != UserType.Admin)
                {
                    if (permss.ListOfPermitedCountriesQuestionnaire != null &&
                        permss.ListOfPermitedCountriesQuestionnaire.Count > 0)
                    {
                        for (int i = 0; i < permss.ListOfPermitedCountriesQuestionnaire.Count; i++)
                        {
                            if (i != 0)
                            {
                                allowed_countriesQ += ",";
                            }
                            allowed_countriesQ += permss.ListOfPermitedCountriesQuestionnaire[i].Country;
                        }
                        h_params.Add("countriesQ", allowed_countriesQ);
                    }
                    if (permss.ListOfPermitedCountriesProcessor != null &&
                        permss.ListOfPermitedCountriesProcessor.Count > 0)
                    {
                        for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++)
                        {
                            if (i != 0)
                            {
                                allowed_countriesP += ", ";
                            }
                            allowed_countriesP += permss.ListOfPermitedCountriesProcessor[i].Country;
                        }
                        h_params.Add("countriesP", allowed_countriesP);
                    }
                }

                h_params.Add("type", Migration.ConvertUserTypeToString(permss.UserType));
				scheduledexports = DB.execProc("select_masterreports", h_params);
                
				scheduledexports.Columns.Add("mode", typeof(string));
				scheduledexports.Columns.Add("day", typeof(string));
				scheduledexports.Columns.Add("enabled", typeof(bool));

				foreach (DataRow single_row in scheduledexports.Rows)
				{
					single_row["mode"] = single_row["schedule_mode"].ToString().Replace("w", "weekly").Replace("d", "daily");
					
					string schedule_day = single_row["schedule_day"].ToString();
					if (schedule_day != "")
					{
						int dw = int.Parse(schedule_day);
						DayOfWeek weekday = (DayOfWeek)dw;
						
						single_row["day"] = weekday.ToString().Substring(0, 2);
					}

					single_row["enabled"] = (permss.UserType == UserType.Admin | permss.EmailAddress == single_row["recipient_email"].ToString());
				}
				scheduledexports.PrimaryKey = new DataColumn[] {scheduledexports.Columns["master_id"]};

				scheduledexports_list.Visible = true;
				scheduledexports_list.DataSource = scheduledexports;
				scheduledexports_list.DataBind();

				Session["scheduledMasterexports"] = scheduledexports;

			}
		}
        //for master report
        //private bool ismasterrpt = false;
        //private MasterReport Master;
        //private string mid = string.Empty;

	
		protected void Page_Load(object sender, System.EventArgs e)
		{
            edit_scheduled_MasterReport editschedule_rpt = null;
            MasterReportNow MasterrptNow = null;
            page_utilities.Set_titles(this.Page, "Export response files");
			permss = check_permissions(this.Page, true);
            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }


            bool bMasterRpt = false;

            if (!IsPostBack)
            {
                if (Context.Handler.GetType().Name.Equals("datamgmt_edit_scheduled_masterreport_aspx"))
                {
                    if ((edit_scheduled_MasterReport)Context.Handler != null)
                    {
                        editschedule_rpt = (edit_scheduled_MasterReport)Context.Handler;
                        bMasterRpt = true;
                    }
                }

                if (Context.Handler.GetType().Name.Equals("datamgmt_masterreportnow_aspx"))
                {
                    if ((MasterReportNow)Context.Handler != null)
                    {
                        MasterrptNow = (MasterReportNow)Context.Handler;
                        bMasterRpt = true;
                    }
                }
            }
                                    

			table_emailerror.Visible = false;
			
			if (!this.IsPostBack)
			{
                pathtotempdir = Server.MapPath(utility.getParameter("path_to_temp"));
				
				//create the values with the report settings
				values = new report_values();
                values.permss_account = permss.EmailAddress;
                values.permss_user = permss.EmailAddress;
                //ismasterrpt = Convert.ToBoolean(Session["isMasterReport"]);
                //for master report
                if (!bMasterRpt)
                {
                    Initialize_pagevariables();
                    values.campaign_name = campaign_name;
                    values.questionnaire_id = questionnaire_id;
                    values.from = from;
                    values.until = until;
                    values.questionnaire_title = questionnaire_title;
                }
                else
                {
                    if (editschedule_rpt != null)
                    {
                        values.Master = editschedule_rpt.mrd;
                        values.IsMasterReport = true;
                        values.from = editschedule_rpt.mrd.Dto.From.Value;
                        values.until = editschedule_rpt.mrd.Dto.To.Value;
                        values.questionnaire_id = editschedule_rpt.QIDs;
                        //values.heading = Master.Dto.MElementHeading.ToString();
                    }
                    else
                    {
                        values.Master = MasterrptNow.mrd;
                        values.IsMasterReport = true;
                        values.from = MasterrptNow.mrd.Dto.From.Value;
                        values.until = MasterrptNow.mrd.Dto.To.Value;
                        values.questionnaire_id = MasterrptNow.QIDs;
                    }
                }
				values.pathtotempdir = pathtotempdir;
                values.schedule_id = "-1";
                values.schedule_master_id = "-1";

				values.scheduled = false;

				mailthread.generate_dataemail(values, true);
			}
		}
Пример #27
0
        public void TestSelectAllPermittedUsersForMasterreport()
        {             
            QuestionnaireDto q1 = SetupQuestionnaireForMasterReport(Q1Elements);
            QuestionnaireDto q2 = SetupQuestionnaireForMasterReport(Q1Elements);
            QuestionnaireDto q3 = SetupQuestionnaireForMasterReport(Q1Elements);
            MasterReport mrp = new MasterReport(TestUser);

            //create report
            mrp.CreateMasterReport("master name", TestUser, Migration.Convert(ScheduleMode.Daily), 0, DateTime.Today.AddDays(-1), DateTime.Today.AddDays(1), true, q1.QuestionnaireId);
            FormRegistry.MasterReportDao.AddQuestionnaireToReport(mrp.Dto.MasterRptId, q1.QuestionnaireId);
            mrp.Save();
            _createdMasterReports.Add(mrp.Dto.MasterRptId);
            List<MasterReportDto> list = FormRegistry.MasterReportDao.GetMasterReports(true, 0, null, null, "ad");
            MasterReportDto mine = list.Find(delegate(MasterReportDto cur) { return cur.MasterRptId == mrp.Dto.MasterRptId; });
            
            string email = "*****@*****.**" + GetNewStamp();
            string login = "******" + GetNewStamp();
            string password = "******";
            bool isAdmin = false;
            UserType type = UserType.CountryUserWithDataAccess;
            UserCompanyType companytype = UserCompanyType.HPI;
            List<CountryDto> listOfPermittedCountriesQuestionnaire = CommonFacade.GetListOfCountries("'uk'");
            int Company_Code = 0;
            UserDto user = new UserDto(email, isAdmin, password, login, type, listOfPermittedCountriesQuestionnaire, null, Company_Code, companytype);
            List<UserDto> listOfUsers = AdminRegistry.UserDao.SelectAllPermittedUsersPermittedForMasterreport(mine.MasterRptId);
            Assert.IsTrue(listOfUsers.Find(u => u.Login == login) == null);

            Assert.IsTrue(AdminRegistry.UserDao.CreateOrUpdate(user, "insert", null, null));
            foreach (CountryDto country in listOfPermittedCountriesQuestionnaire)
            {
                UserFacade.CreateOrUpdate(user, "country", "q", country.Country);
            }

            UserDto sel = AdminRegistry.UserDao.GetByLogin(login);
            Assert.IsTrue(listOfUsers.Find(u => u.Equals(sel)) != null);
            Assert.IsTrue(AdminRegistry.UserDao.Delete(user));            
            
        }
Пример #28
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
            string recipient = string.Empty;
            //if (IsPostBack)
            //{

            //    if (dd_possible_users.SelectedIndex != 0)
            //        recipient = dd_possible_users.SelectedItem.Text;
            //    else
            //        recipient = tb_recipient.Text;
            //}
            page_utilities.Set_titles(this, "Schedule Master Reports");
            permss = check_permissions(this.Page, true);
            if (permss.UserType == UserType.CountryUserWithoutDataAccess)
            {
                Response.Redirect("index.aspx", true);
            }

            //content = Request.QueryString["content"];

            if (!IsPostBack)
            {
                admin_behalf.Visible = false;
                schedule_mode.Items.Add(new ListItem(MasterReport.schdule_modeselect,"0"));
                schedule_mode.Items.Add(new ListItem(MasterReport.daily , "d"));
                schedule_mode.Items.Add(new ListItem(MasterReport.weekly, "w"));
            }

            index_MasterReport MasterrptNow = null;

            if (!IsPostBack)
            {
                if (Context.Handler.GetType().Name.Equals("datamgmt_index_masterreport_aspx"))
                {
                    if ((index_MasterReport)Context.Handler != null)
                    {
                        MasterrptNow = (index_MasterReport)Context.Handler;
                        tbreportname.Text = MasterrptNow.Masterrptname;
                        MaterRptId.Value = Convert.ToString(MasterrptNow.MstrId);
                    }
                }
            }

                #region Validation for Same Master report name
                Hashtable h_masterparams = new Hashtable();

                string countriesQ = null;
                string countriesP = null;
                if (permss.UserType != UserType.Admin)
                {
                    if (permss.ListOfPermitedCountriesQuestionnaire != null &&
                       permss.ListOfPermitedCountriesQuestionnaire.Count > 0)
                    {
                        countriesQ = String.Empty;
                        for (int i = 0; i < permss.ListOfPermitedCountriesQuestionnaire.Count; i++)
                        {
                            if (i != 0)
                            {
                                countriesQ += ",";
                            }
                            countriesQ += permss.ListOfPermitedCountriesQuestionnaire[i].Country;
                        }
                    }
                    if (permss.ListOfPermitedCountriesProcessor != null &&
                        permss.ListOfPermitedCountriesProcessor.Count > 0)
                    {
                        countriesP = String.Empty;
                        for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++)
                        {
                            if (i != 0)
                            {
                                countriesP += ",";
                            }
                            countriesP += permss.ListOfPermitedCountriesProcessor[i].Country;
                        }
                    }
                }
                h_masterparams.Add("countriesQ", countriesQ);
                h_masterparams.Add("countriesP", countriesP);
                h_masterparams.Add("type", Migration.ConvertUserTypeToString(permss.UserType));
                DataTable MasterReportNames = DB.execProc("select_masterreports", h_masterparams);

                DataRow[] MasterName = null;
                Int32 Masterrpt_id = 0;

                if(MasterReportNames != null)
                {
                    if (MasterReportNames.Rows.Count > 0)
                    {                        
                        if (int.TryParse(MaterRptId.Value, out Masterrpt_id))
                            MasterName = MasterReportNames.Select("master_id = '" + Masterrpt_id + "'");
                    }
                }


                if (MasterName.Length > 0)
                {
                    if (!IsPostBack)
                    {
                        if (!string.IsNullOrEmpty(MasterName[0]["schedule_mode"].ToString()))
                            schedule_mode.Items.FindByValue(MasterName[0]["schedule_mode"].ToString()).Selected = true;

                        tbreportname.Text = MasterName[0]["master_name"].ToString();
                        if (schedule_mode.SelectedItem.Value == "w")
                        {
                            schedule_day.Enabled = true;
                            schedule_day.SelectedItem.Selected = false;
                            schedule_day.Items.FindByValue(MasterName[0]["schedule_day"].ToString()).Selected = true;
                        }
                        if (bool.Parse(MasterName[0]["isscheduled"].ToString()))
                            recipient = MasterName[0]["recipient_email"].ToString();
                    }


               }
                #endregion

 
                if (permss.UserType == UserType.Admin)
                {
                    if (!IsPostBack)
                    {
                        admin_behalf.Visible = true;

                        dd_possible_users.Enabled = true;

                        #region load dd_user and select if possible
                        Hashtable h_params = new Hashtable();
                        h_params.Add("masterID", Masterrpt_id);
                        DataTable DtFinalUsers = DB.execProc("select_users_permitted_for_masterreport", h_params);
                        
                        if (DtFinalUsers != null)
                        {
                            if (DtFinalUsers.Rows.Count > 0)
                            {
                                dd_possible_users.DataSource = DtFinalUsers;
                                dd_possible_users.DataTextField = "useremail";
                            }
                        }

                        DataRow addingRow;
                        addingRow = DtFinalUsers.NewRow();
                        addingRow["useremail"] = "-- Please choose... --";
                        DtFinalUsers.Rows.InsertAt(addingRow, 0);

                        dd_possible_users.DataBind();

                        ListItem found_user = dd_possible_users.Items.FindByText(recipient);

                        if (found_user != null)
                        {
                            dd_possible_users.SelectedItem.Selected = false;
                            found_user.Selected = true;
                            //tb_recipient.Text = string.Empty;
                        }
                        else
                        {
                            tb_recipient.Text = recipient;
                        }
                    }
                    #endregion

                }
         //   }

		}
Пример #29
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here

			page_utilities.Set_titles(this, "Create copy of existing processor");
			permss = check_permissions(this.Page, true);

			validator_table.Visible = false;
			mssg_table.Visible = false;

			if(!this.IsPostBack)
			{
				Hashtable h_params = new Hashtable();
                DataTable languages = DB.execProc("select_languages", h_params);
				string sCountries = "";
                string countriesP = null;

				if (permss.UserType != UserType.Admin)
				{
                    countriesP = String.Empty;

                    if (permss.ListOfPermitedCountriesProcessor != null &&
                        permss.ListOfPermitedCountriesProcessor.Count > 0)
                    {
                        for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++)
                        {
                            if (i != 0)
                            {
                                sCountries += ", ";
                                countriesP += ",";
                            }
                            sCountries += "'" + permss.ListOfPermitedCountriesProcessor[i].Country + "'";
                            countriesP += permss.ListOfPermitedCountriesProcessor[i].Country;
                        }
                    }
                    else
                    {
                        sCountries = "''";                        
                    }
                    h_params.Add("countries", sCountries);
				}
                else
                {
                    List<CountryDto> listOfCountries = CommonFacade.GetListOfCountries(null);
                    countriesP = String.Empty;
                    for (int i = 0; i < listOfCountries.Count; i++)
                    {
                        if (i != 0)
                        {
                            countriesP += ",";
                        }
                        countriesP += listOfCountries[i].Country;
                    }
                }
                
                DataTable countries = DB.execProc("select_countries", h_params);                
                List<CountryLanguageDto> localizationsList = FormRegistry.PredefinedQuestionDao.GetCoutryLanguage(null, null, null);
                PredefinedQuestionFacade.AddRegionAndFKForCountryLanguage(localizationsList, countries, languages);
                List<CountryLanguageDto> permitLocalizationsList = new List<CountryLanguageDto>();
                permitLocalizationsList.Add(new CountryLanguageDto() { DisplayName = "-- Please choose --", LocalizationId = -1 });
                permitLocalizationsList.AddRange(PredefinedQuestionFacade.FilterByCoutryIdList(localizationsList, countries));
				//filling in and display a dropdown-list of all non-empty campaigns stored in the db

				List<CampaignDto> campaigns_copyto = new List<CampaignDto>();
                campaigns_copyto.Add(new CampaignDto()
                {
                    CampaignCode = "-- Please choose... --"
                });
                List<CampaignDto> tempCamp1 = CampaignFacade.SelectCampaignsByCodeCountriesTypeAndIndicatorIfEmpty(null, null, countriesP, 1);
                if (tempCamp1 != null && tempCamp1.Count > 0)
                    campaigns_copyto.AddRange(tempCamp1);
				

				//don't show empty campaigns (campaigns without any questionnaire)
                List<CampaignDto> campaigns_copyfrom = new List<CampaignDto>();
                campaigns_copyfrom.Add(new CampaignDto()
                    {
                        CampaignCode = "-- Please choose... --"
                    });
                List<CampaignDto> tempCamp2 = CampaignFacade.SelectCampaignsByCodeCountriesTypeAndIndicatorIfEmpty(null, null, countriesP, 0);
                if (tempCamp2 != null && tempCamp2.Count > 0)
                    campaigns_copyfrom.AddRange(tempCamp2);
								
				campaign_code_FK.DataSource = campaigns_copyto;
				campaign_code_FK.DataTextField ="CampaignCode";
				campaign_code_FK.DataBind();
				campaign_code_FK.Items[0].Selected = true;
				
				copy_campaignlist.DataSource = campaigns_copyfrom;
				copy_campaignlist.DataTextField ="CampaignCode";
				copy_campaignlist.DataBind();
				copy_campaignlist.Items[0].Selected = true;

                localization_FK.DataSource = permitLocalizationsList;
                localization_FK.DataTextField = "DisplayName";
                localization_FK.DataValueField = "LocalizationId";
                localization_FK.DataBind();
                localization_FK.Items[0].Selected = true;
                ViewState["countries"] = permitLocalizationsList;				

			}
		}
Пример #30
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			page_utilities.Set_titles(this, "RFG Processor Management");
	
			permss = check_permissions(this.Page, true);

            //ANNA : changed permissions and every user have an access to processor mgmt
            /*
            if (permss.UserType != UserType.Admin)
            {
                Response.Redirect(utility.getParameter("UrlToApplication") + "index.aspx", true);
            }
             */

            bool preselectCampaign = false;

            string preselectedCampaign = String.Empty;
            string preselectedPid = String.Empty;

            if (!this.IsPostBack)
            {
                if (Request.QueryString["found"] != null)
                {
                    //user came from find_questionnaire.aspx, so display found campaign and markup found questionnaire

                    if (Session["campaign"] != null)
                    {
                        preselectCampaign = true;
                        preselectedCampaign = Session["campaign"].ToString();
                        preselectedPid = Session["processorID"].ToString();
                    }
                    else
                    {
                        Response.Redirect("index.aspx");
                    }
                }
            }

			Session.Clear();

			Session["permissions"] = permss;

			if (!this.IsPostBack)
			{
                List<LanguageDto> languages = new List<LanguageDto>();
                languages.Add(new LanguageDto()
                    {
                        LanguageName = "-- Please choose --",
                        LanguageFK = "--"
                    });
                List<LanguageDto> tempL = CommonFacade.GetListOfLanguages();
                if (tempL != null && tempL.Count > 0)
                    languages.AddRange(tempL);

				//filling in and display a dropdown-list of all relevant campaigns stored in the db
				string allowed_countries = null;
                string countriesP = null;
				
				if (permss.UserType != UserType.Admin)
				{
                    allowed_countries = String.Empty;

                    if (permss.ListOfPermitedCountriesProcessor != null &&
                        permss.ListOfPermitedCountriesProcessor.Count > 0)
                    {
                        for (int i = 0; i < permss.ListOfPermitedCountriesProcessor.Count; i++)
                        {
                            if (i != 0)
                            {
                                allowed_countries += ", ";
                                countriesP += ",";
                            }
                            allowed_countries += "'" + permss.ListOfPermitedCountriesProcessor[i].Country + "'";
                            countriesP += permss.ListOfPermitedCountriesProcessor[i].Country;
                        }
                    }
                    else
                    {
                        allowed_countries = "''";
                        countriesP = String.Empty;
                    }
				}

                List<CountryDto> countries = new List<CountryDto>();
                countries.Add(new CountryDto()
                    {
                        Country = "--",
                        CountryName = "-- Please choose... --"
                    });
                
                List<CountryDto> tempC = CommonFacade.GetListOfCountries(allowed_countries);
                if (tempC != null && tempC.Count > 0)
                    countries.AddRange(tempC);
                
                List<CampaignDto> campaigns = new List<CampaignDto>();
                campaigns.Add(new CampaignDto()
                {
                    CampaignCode = "-- Please choose.. --"
                });
                List<CampaignDto> tempCamp = CampaignFacade.SelectCampaignsByCodeCountriesTypeAndIndicatorIfEmpty(null, null, countriesP, 1);
                if (tempCamp != null && tempCamp.Count > 0)
                {
                    campaigns.AddRange(tempCamp);
                }
                
				campaign_code_FK.DataSource = campaigns;
				campaign_code_FK.DataTextField ="CampaignCode";
				campaign_code_FK.DataBind();
				campaign_code_FK.Items[0].Selected = true;
				
				
				country_FK.DataSource = countries;
				country_FK.DataTextField ="CountryName";
				country_FK.DataValueField = "Country";
				country_FK.DataBind();
				country_FK.Items[0].Selected = true;

                language_FK.DataSource = languages;
				language_FK.DataTextField ="LanguageName";
                language_FK.DataValueField = "LanguageFK";
				language_FK.DataBind();
				language_FK.Items[0].Selected = true;

                if (preselectCampaign)
                {
                    //user came from find_processor.aspx, so display found campaign and markup found processor
                    campaign_code_FK.SelectedValue = preselectedCampaign;
                    display_list_Click(null, null, preselectedPid);
                }
			}
		}