Пример #1
0
        public void SetData(int courseId, string courseShortName, string courseFullName, List <Academic.DbEntities.Class.UserClass> userClasses)
        {
            lnkCourseName.Text        = courseShortName;
            lnkCourseName.NavigateUrl = "/Views/Course/Section/?SubId=" + courseId;
            lnkCourseName.ToolTip     = courseFullName;

            var clsList = new List <IdAndName>();

            foreach (var u in userClasses)
            {
                var name = u.SubjectClass.GetName;
                var item = new IdAndName()
                {
                    Name = name
                    ,
                    Value = "~/Views/Class/CourseClassDetail.aspx?ccId=" + u.SubjectClass.Id
                    ,
                    IdInString = "Click to view class"
                };
                clsList.Add(item);
            }

            dListClasses.DataSource = clsList.OrderBy(x => x.Name);
            dListClasses.DataBind();
        }
        private async void buttonX2_Click(object sender, EventArgs e)
        {
            if (!dataGridViewX1.Columns.Contains("تاريخ1"))
            {
                dataGridViewX1.Columns.Add("تاريخ1", "تاريخ");
            }

            if (!dataGridViewX1.Columns.Contains("تاريخ2"))
            {
                dataGridViewX1.Columns.Add("تاريخ2", "تاريخ");
            }

            if (!dataGridViewX1.Columns.Contains("الاسم1"))
            {
                dataGridViewX1.Columns.Add("الاسم1", "تاريخ");
            }

            for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
            {
                if (ClassConvert.Convint(dataGridViewX1.Rows[i].Cells["id"].Value) > 0)
                {
                    IdAndName vit = await Vitl.GetbyidIdAndName(ClassConvert.Convint(dataGridViewX1.Rows[i].Cells["id"].Value));

                    dataGridViewX1.Rows[i].Cells["الاسم1"].Value = vit.Name;
                    dataGridViewX1.Rows[i].Cells["تاريخ1"].Value = vit.Regesterdeg.ToShortDateString();

                    dataGridViewX1.Rows[i].Cells["تاريخ2"].Value = vit.Regesterdeg.ToLongDateString();
                }
            }
        }
Пример #3
0
        protected void ddlClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            var list = ViewState["SelectedClasses"] as List <IdAndName>;

            if (list != null)
            {
                var sel = ddlClass.SelectedItem;
                if (sel != null)
                {
                    var item = new IdAndName()
                    {
                        Id = Convert.ToInt32(sel.Value)
                        ,
                        Name = sel.Text
                    };
                    list.Add(item);
                    var uc = (EachClass)Page.LoadControl
                                 ("~/Views/ActivityResource/Class/EachClass.ascx");
                    uc.SetValues(item);
                    uc.RemoveClicked += uc_RemoveClicked;
                    pnlClasses.Controls.Add(uc);
                    pnlClasses.Visible = true;
                    ddlClass.Items.Remove(sel);
                }
            }
            //PopulateClasses(list);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var loadType = Request.QueryString["type"];
                var curNode  = new IdAndName()
                {
                    Name = "Current courses"
                };
                LstUc1.LoadType = loadType;

                if (loadType == "earlier")
                {
                    lblHeading.Text     = "Earlier courses";
                    lblTitle.Text       = "Earlier courses";
                    curNode.Name        = "Earlier courses";
                    lnkGoto.Text        = "Go to current courses";
                    lnkGoto.NavigateUrl = "~/Views/Courses/?type=current";
                }
                else
                {
                    lblHeading.Text     = "Current courses";
                    lblTitle.Text       = "Current courses";
                    lnkGoto.Text        = "Go to earlier courses";
                    lnkGoto.NavigateUrl = "~/Views/Courses/?type=earlier";
                }
                var user = Page.User as CustomPrincipal;
                if (user != null)
                {
                    if (SiteMap.CurrentNode != null)
                    {
                        var list = new List <IdAndName>()
                        {
                            new IdAndName()
                            {
                                Name    = SiteMap.RootNode.Title
                                , Value = SiteMap.RootNode.Url
                                , Void  = true
                            },
                            curNode
                        };
                        SiteMapUc.SetData(list);
                    }
                    //LstUc1.SchoolId = user.SchoolId;//Values.Session.GetSchool(Session);
                    LstUc1.UserId         = user.Id;             //Values.Session.GetUser(Session);
                    LstUc1.AcademicYearId = user.AcademicYearId; //Values.Session.GetAcademicYear(Session);
                    LstUc1.SessionId      = user.SessionId;      //Values.Session.GetSession(Session);
                    LstUc1.UserType       = "student";
                }
                else
                {
                    //logout the user
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Indicates to the reporter that a new scenario has begun.
        /// </summary>
        /// <param name="scenarioName">The scenario name.</param>
        /// <param name="featureName">The feature name.</param>
        /// <param name="scenarioIdentity">The screenplay scenario identity.</param>
        public void BeginNewScenario(IdAndName scenarioName,
                                     IdAndName featureName,
                                     Guid scenarioIdentity)
        {
            var report = new BeginScenarioReport(scenarioName?.Identity,
                                                 scenarioName?.Name,
                                                 featureName?.Identity,
                                                 featureName?.Name);

            Trace(TraceConstants.BeginNewScenario, report);
        }
Пример #6
0
 /// <summary>
 /// Indicates to the reporter that a new scenario has begun.
 /// </summary>
 /// <param name="scenarioName">The scenario name.</param>
 /// <param name="featureName">The feature name.</param>
 /// <param name="scenarioIdentity">The screenplay scenario identity.</param>
 public void BeginNewScenario(IdAndName scenarioName,
                              IdAndName featureName,
                              Guid scenarioIdentity)
 {
     builder.BeginNewScenario(scenarioName?.Identity,
                              scenarioName?.Name,
                              featureName?.Name,
                              featureName?.Identity,
                              scenarioIdentity,
                              (scenarioName?.IsIdentityGenerated).GetValueOrDefault(),
                              (featureName?.IsIdentityGenerated).GetValueOrDefault());
 }
Пример #7
0
        /// <summary>
        /// Gets the default configuration collection.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        private static IdAndName[] GetDefaultConfigurationCollection(ITestManagementTeamProject project)
        {
            ITestConfiguration defaultConfig = null;

            foreach (ITestConfiguration config in project.TestConfigurations.Query("Select * from TestConfiguration"))
            {
                defaultConfig = config;
                break;
            }

            IdAndName defaultConfigIdAndName = new IdAndName(defaultConfig.Id, defaultConfig.Name);

            return(new IdAndName[] { defaultConfigIdAndName });
        }
Пример #8
0
        public TestCaseViewModel(ITestSuiteEntry testcase, IdAndName configuration, bool Async = true)
        {
            this.ConfigurationId = configuration.Id;
            this.ConfigurationName = configuration.Name;

            this.TestCase = testcase;
            this._testCaseObject = testcase.TestCase ?? TfsShared.Instance.SourceTestProject.TestCases.Find(testcase.Id);

            this.Owner = _testCaseObject.OwnerName;
            this.State = _testCaseObject.State;

            this.Title = testcase.Title;
            this.Id = testcase.Id;

            if (Async)
            {
                Thread t = new Thread(new ThreadStart(CollectTestCaseDetails));
                t.Start();
            }
            else
            {
                CollectTestCaseDetails();
            }
        }
Пример #9
0
        public TestCaseViewModel(ITestSuiteEntry testcase, IdAndName configuration, bool Async = true)
        {
            this.ConfigurationId   = configuration.Id;
            this.ConfigurationName = configuration.Name;

            this.TestCase        = testcase;
            this._testCaseObject = testcase.TestCase ?? TfsShared.Instance.SourceTestProject.TestCases.Find(testcase.Id);

            this.Owner = _testCaseObject.OwnerName;
            this.State = _testCaseObject.State;

            this.Title = testcase.Title;
            this.Id    = testcase.Id;

            if (Async)
            {
                Thread t = new Thread(new ThreadStart(CollectTestCaseDetails));
                t.Start();
            }
            else
            {
                CollectTestCaseDetails();
            }
        }
 /// <summary>
 /// Indicates to the reporter that a new scenario has begun.
 /// </summary>
 /// <param name="scenarioName">The scenario name.</param>
 /// <param name="featureName">The feature name.</param>
 /// <param name="scenarioIdentity">The screenplay scenario identity.</param>
 public void BeginNewScenario(IdAndName scenarioName, IdAndName featureName, Guid scenarioIdentity)
 {
 }
        /// <summary>
        /// Gets the default configuration collection.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        private static IdAndName[] GetDefaultConfigurationCollection(ITestManagementTeamProject project)
        {
            ITestConfiguration defaultConfig = null;
            foreach (ITestConfiguration config in project.TestConfigurations.Query("Select * from TestConfiguration"))
            {
                defaultConfig = config;
                break;
            }

            IdAndName defaultConfigIdAndName = new IdAndName(defaultConfig.Id, defaultConfig.Name);
            return new IdAndName[] { defaultConfigIdAndName };
        }
        private void AssignTesters(ITestSuiteBase sourceSuite, ITestSuiteBase targetSuite)
        {
            if (targetSuite == null)
            {
                Trace.TraceError($"Target Suite is NULL");
            }

            List <ITestPointAssignment> assignmentsToAdd = new List <ITestPointAssignment>();

            //loop over all source test case entries
            foreach (ITestSuiteEntry sourceTce in sourceSuite.TestCases)
            {
                // find target testcase id for this source tce
                WorkItem targetTc = targetWitStore.FindReflectedWorkItem(sourceTce.TestCase.WorkItem, me.ReflectedWorkItemIdFieldName, false);

                if (targetTc == null)
                {
                    Trace.TraceError($"Target Reflected Work Item Not found for source WorkItem ID: {sourceTce.TestCase.WorkItem.Id}");
                }

                //figure out test point assignments for each source tce
                foreach (ITestPointAssignment tpa in sourceTce.PointAssignments)
                {
                    int sourceConfigurationId = tpa.ConfigurationId;

                    TeamFoundationIdentity targetIdentity = null;

                    if (tpa.AssignedTo != null)
                    {
                        targetIdentity = GetTargetIdentity(tpa.AssignedTo.Descriptor);
                        if (targetIdentity == null)
                        {
                            sourceIdentityManagementService.RefreshIdentity(tpa.AssignedTo.Descriptor);
                        }

                        targetIdentity = GetTargetIdentity(tpa.AssignedTo.Descriptor);
                    }

                    // translate source configuration id to target configuration id and name
                    //// Get source configuration name
                    string sourceConfigName = (from tc in sourceTestConfigs
                                               where tc.Id == sourceConfigurationId
                                               select tc.Name).FirstOrDefault();

                    //// Find source configuration name in target and get the id for it
                    int targetConfigId = (from tc in targetTestConfigs
                                          where tc.Name == sourceConfigName
                                          select tc.Id).FirstOrDefault();

                    if (targetConfigId != 0)
                    {
                        IdAndName targetConfiguration = new IdAndName(targetConfigId, sourceConfigName);

                        var targetUserId = Guid.Empty;
                        if (targetIdentity != null)
                        {
                            targetUserId = targetIdentity.TeamFoundationId;
                        }

                        // Create a test point assignment with target test case id, target configuration (id and name) and target identity
                        var newAssignment = targetSuite.CreateTestPointAssignment(
                            targetTc.Id,
                            targetConfiguration,
                            targetUserId);

                        // add the test point assignment to the list
                        assignmentsToAdd.Add(newAssignment);
                    }
                    else
                    {
                        Trace.Write($"Cannot find configuration with name [{sourceConfigName}] in target. Cannot assign tester to it.", "TestPlansAndSuites");
                    }
                }
            }

            // assign the list to the suite
            targetSuite.AssignTestPoints(assignmentsToAdd);
        }
Пример #13
0
        private void LoadStructureType()
        {
            var newNode = new IdAndName()
            {
                Name = "Structure edit"
            };

            switch (StructureType)
            {
            //case "lev":
            //    lblHeading.Text = "Level edit";
            //    lblTabHead.Text = "Level edit";
            //    break;
            //case "fac":
            //    lblHeading.Text = "Faculty edit";
            //    lblTabHead.Text = "Faculty edit";
            //    break;

            case "pro":
                lblHeading.Text = "Program edit";
                lblTabHead.Text = "Program edit";
                newNode.Name    = "Program edit";
                break;

            case "yr":
                EnableYearMode();
                lblHeading.Text      = "Year edit";
                lblTabHead.Text      = "Year edit";
                position_row.Visible = true;
                newNode.Name         = "Year edit";
                rowDescription.Style.Add("visibility", "collapse");
                break;

            case "syr":
                lblHeading.Text      = "Sub-year edit";
                lblTabHead.Text      = "Sub-year edit";
                position_row.Visible = true;
                newNode.Name         = "Sub-year edit";
                break;
            }
            if (SiteMap.CurrentNode != null)
            {
                var list = new List <IdAndName>()
                {
                    new IdAndName()
                    {
                        Name    = SiteMap.RootNode.Title
                        , Value = SiteMap.RootNode.Url
                        , Void  = true
                    },
                    new IdAndName()
                    {
                        Name    = SiteMap.CurrentNode.ParentNode.Title
                        , Value = SiteMap.CurrentNode.ParentNode.Url + "?edit=1"
                        , Void  = true
                    }
                    , newNode
                };
                SiteMapUc.SetData(list);
            }
        }
Пример #14
0
        private void AssignTesters(ITestSuiteBase sourceSuite, ITestSuiteBase targetSuite)
        {
            List <ITestPointAssignment> assignmentsToAdd = new List <ITestPointAssignment>();

            //loop over all source test case entries
            foreach (ITestSuiteEntry sourceTce in sourceSuite.TestCases)
            {
                // find target testcase id for this source tce
                WorkItem targetTc = targetWitStore.FindReflectedWorkItem(sourceTce.TestCase.WorkItem, me.ReflectedWorkItemIdFieldName, false);

                //figure out test point assignments for each source tce
                foreach (ITestPointAssignment tpa in sourceTce.PointAssignments)
                {
                    string sourceAssignedToName  = tpa.AssignedToName;
                    int    sourceConfigurationId = tpa.ConfigurationId;

                    var sourceIdentity = sourceIdentityManagementService.ReadIdentity(
                        tpa.AssignedTo.Descriptor,
                        MembershipQuery.Direct,
                        ReadIdentityOptions.ExtendedProperties);
                    string sourceIdentityMail = sourceIdentity.GetProperty("Mail") as string;

                    if (!string.IsNullOrEmpty(sourceIdentityMail))
                    {
                        //translate source assignedtoname to target identity
                        var targetIdentity = targetIdentityManagementService.ReadIdentity(
                            IdentitySearchFactor.MailAddress,
                            sourceIdentityMail,
                            MembershipQuery.Direct,
                            ReadIdentityOptions.None);

                        if (targetIdentity != null)
                        {
                            //translate source configuration id to target configuration id and name
                            //// Get source configuration name
                            string sourceConfigName = (from tc in sourceTestConfigs
                                                       where tc.Id == sourceConfigurationId
                                                       select tc.Name).FirstOrDefault();
                            //// Find source configuration name in target and get the id for it
                            int targetConfigId = (from tc in targetTestConfigs
                                                  where tc.Name == sourceConfigName
                                                  select tc.Id).FirstOrDefault();

                            if (targetConfigId != 0)
                            {
                                IdAndName targetConfiguration = new IdAndName(targetConfigId, sourceConfigName);

                                // Create a test point assignment with target test case id, target configuration (id and name) and target identity
                                ITestPointAssignment newAssignment = targetSuite.CreateTestPointAssignment(
                                    targetTc.Id,
                                    targetConfiguration,
                                    targetIdentity);

                                // add the test point assignment to the list
                                assignmentsToAdd.Add(newAssignment);
                            }
                            else
                            {
                                Trace.Write($"Cannot find configuration with name [{sourceConfigName}] in target. Cannot assign tester to it.", "TestPlansAndSuites");
                            }
                        }
                        else
                        {
                            Trace.Write($"Cannot find tester with e-mail [{sourceIdentityMail}] in target system. Cannot assign.", "TestPlansAndSuites");
                        }
                    }
                    else
                    {
                        Trace.Write($"No e-mail address known in source system for [{sourceIdentity.DisplayName}]. Cannot translate to target.", "TestPlansAndSuites");
                    }
                }
            }
            // assign the list to the suite
            targetSuite.AssignTestPoints(assignmentsToAdd);
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblErrorMsg.Visible = false;
            if (!IsPostBack)
            {
                var user = Page.User as CustomPrincipal;
                if (user != null)
                {
                    IdAndName noticeName = null;
                    var       nId        = Request.QueryString["nId"];
                    if (nId != null)
                    {
                        NoticeId = Convert.ToInt32(nId);
                        using (var helper = new DbHelper.Notice())
                        {
                            var notice = helper.GetNotice(NoticeId);
                            if (notice != null)
                            {
                                noticeName = new IdAndName()
                                {
                                    Name = notice.Title, Value = "~/Views/NoticeBoard/NoticeDetail.aspx?nId=" + notice.Id, Void = true
                                };
                                txtHeading.Text            = notice.Title;
                                CKEditor1.Text             = notice.Content;
                                chkPublish.Checked         = notice.PublishNoticeToNoticeBoard;
                                ddlPublishTo.SelectedIndex = (notice.NoticePublishTo ?? false) ? 0 : 1;

                                ddlPublishTo.Visible = notice.PublishNoticeToNoticeBoard;

                                lblPageitle.Text = "Notice Edit";

                                //var updaetd = helper.AddOrUpdateNoticeNotification(Convert.ToInt32(nId), user.Id);
                            }
                        }
                    }

                    if (SiteMap.CurrentNode != null)
                    {
                        var list = new List <IdAndName>()
                        {
                            new IdAndName()
                            {
                                Name    = SiteMap.RootNode.Title
                                , Value = SiteMap.RootNode.Url
                                , Void  = true
                            },
                            new IdAndName()
                            {
                                Name    = SiteMap.CurrentNode.ParentNode.Title
                                , Value = SiteMap.CurrentNode.ParentNode.Url
                                , Void  = true
                            }
                            ,
                        };
                        if (noticeName != null)
                        {
                            list.Add(noticeName);
                            //list.Add(new IdAndName(){});
                            list.Add(new IdAndName()
                            {
                                Name = "Edit"
                                       //,Value = SiteMap.CurrentNode.Url
                                       //,Void=true
                            });
                        }
                        else
                        {
                            list.Add(new IdAndName()
                            {
                                Name = SiteMap.CurrentNode.Title
                                       //,Value = SiteMap.CurrentNode.Url
                                       //,Void=true
                            });
                        }

                        SiteMapUc.SetData(list);
                    }
                }
            }
        }
        public static void DataGridEnterGridToWorkNameOfCouress_ta(DevComponents.DotNetBar.Controls.DataGridViewX Grid, Couress TeamClassList, IdAndName nameInfrma)
        {
            DevComponents.DotNetBar.Controls.DataGridViewComboBoxExColumn id_NameOfCouress = (DevComponents.DotNetBar.Controls.DataGridViewComboBoxExColumn)Grid.Columns["id_NameOfCouress"];

            Grid.Rows.Add(TeamClassList.id, nameInfrma.Name, TeamClassList.NumberOfdayregest, TeamClassList.Result);
        }
Пример #17
0
        static void Main(string[] args)
        {
            Word.Application word = new Word.Application();
            Word.Document    doc  = new Word.Document();

            // Define an object to pass to the API for missing parameters
            object missing = System.Type.Missing;

            doc = word.Documents.Open(@"D:\RQemploi\WordReader\TestDoc.docx",
                                      ref missing, ref missing, ref missing, ref missing,
                                      ref missing, ref missing, ref missing, ref missing,
                                      ref missing, ref missing, ref missing, ref missing,
                                      ref missing, ref missing, ref missing);

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

            for (int i = 0; i < doc.Paragraphs.Count; i++)
            {
                string temp = doc.Paragraphs[i + 1].Range.Text.Trim();
                if (temp != string.Empty)
                {
                    data.Add(temp);
                }
            }

            for (int i = 0; i < doc.Paragraphs.Count; i++)
            {
                Console.WriteLine(data[i]);
            }

            Console.ReadLine();

            ((Word._Document)doc).Close();
            ((Word._Application)word).Quit();


            //MTM

            string serverurl = "http://localhost:8080/tfs";
            string project   = "project name on tfs server";
            ITestManagementTeamProject proj = GetProject(serverurl, project);

            //create plan
            ITestPlan plan = proj.TestPlans.Create();

            plan.Name      = "sprint name";
            plan.StartDate = DateTime.Now;
            plan.EndDate   = DateTime.Now.AddMonths(1);
            plan.Save();

            //create suite for plan
            IStaticTestSuite suite = proj.TestSuites.CreateStatic();

            suite.Title = "Types of test cases";

            plan.RootSuite.Entries.Add(suite);
            plan.Save();

            //Config for adding test cases to suite
            ITestConfiguration defaultConfig = null;

            foreach (ITestConfiguration config in proj.TestConfigurations.Query(
                         "Select * from TestConfiguration"))
            {
                defaultConfig = config;
                break;
            }

            //adding the test case to the suite
            ITestCase testCase = proj.TestCases.Create();

            testCase.Title = "Verify X";
            testCase.Save();

            IdAndName defaultConfigIdAndName = new IdAndName(defaultConfig.Id, defaultConfig.Name);

            suite.Entries.Add(testCase);
            plan.Save();
        }