Beispiel #1
0
 public void InputFormFields_Item()
 {
     ItemTypeForm.Data = Data.ItemTypeData;
     ItemTypeForm.QuestionAnswerDataObject = Data.QuestionAnswerData;
     ItemTypeForm.AutoItDataObject         = Data.AutoItData;
     ItemTypeForm.InputFormFields();
 }
Beispiel #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ItemTypeForm MasterEntity = (ItemTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_ItemTypeForm WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ItemTypeForm EntityGet()
        {
            ItemTypeForm entity = new ItemTypeForm();

            entity.ID = HTDataID;
            return(entity);
        }
 /// <summary>
 /// EditQuestion page, return new instance of the form type.
 /// Ie ItemTypeOpenResponseForm, ItemTypeFormMultipleChoice, ItemTypeFormTrueFalse ...
 /// </summary>
 /// <remarks>requires the EditQuestionCreateNewItemPage to be initialized in this class</remarks>
 /// <param name="itemTypeForm">ItemTypeForm</param>
 private void setItemTypeForm(ItemTypeForm itemTypeForm)
 {
     if (itemTypeForm.GetType() == typeof(ItemTypeMultipleChoiceForm))
     {
         ItemTypeForm = new ItemTypeMultipleChoiceForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeTrueFalseForm))
     {
         ItemTypeForm = new ItemTypeTrueFalseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeGriddedForm))
     {
         ItemTypeForm = new ItemTypeGriddedForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeOpenResponseForm))
     {
         ItemTypeForm = new ItemTypeOpenResponseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeInlineResponseForm))
     {
         ItemTypeForm = new ItemTypeInlineResponseForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeMatchingForm))
     {
         ItemTypeForm = new ItemTypeMatchingForm();
     }
     else if (itemTypeForm.GetType() == typeof(ItemTypeDragDropForm))
     {
         ItemTypeForm = new ItemTypeDragDropForm();
     }
 }
Beispiel #5
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ItemTypeForm entity = (ItemTypeForm)p_BE;
                string       sql    = string.Empty;

                sql = " SELECT 1 FROM  Data_ItemTypeForm WHERE CLSA= " + SysString.ToDBString(entity.CLSA) +
                      " AND CLSB= " + SysString.ToDBString(entity.CLSB);
                DataTable dt = SysUtils.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("该大类、小类已经存在,请重新输入!");
                }

                ItemTypeFormCtl control = new ItemTypeFormCtl(sqlTrans);
                //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_ItemTypeForm,sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            ItemTypeFormRule rule   = new ItemTypeFormRule();
            ItemTypeForm     entity = EntityGet();

            rule.RDelete(entity);
        }
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            ItemTypeFormRule rule   = new ItemTypeFormRule();
            ItemTypeForm     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
 /// <summary>
 /// the create new item page constructor
 /// </summary>
 /// <param name="itemTypeForm">item type form</param>
 public EditTestItemCreateNewItemPage(ItemTypeForm itemTypeForm)
     : base()
 {
     this._itemTypeForm = itemTypeForm;
     this._itemType     = itemTypeForm.ItemType;
     this.Name          = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
     this.PrintName();
     InitElements();
 }
Beispiel #9
0
 public EditTaskForm(ItemTypeForm itemTypeForm, string overrideControlPrefix = null)
     : base(itemTypeForm, overrideControlPrefix, PageNames.EditTask)
 {
     if (overrideControlPrefix != null)
     {
         this.ControlPrefix = overrideControlPrefix;
     }
     InitElements();
 }
 /// <summary>
 /// the edit question form constructor
 /// </summary>
 /// <param name="itemTypeForm">item type form</param>
 /// <param name="overrideControlPrefix">override control prefix</param>
 public EditQuestionCreateNewItemForm(ItemTypeForm itemTypeForm, string overrideControlPrefix = null)
     : base(itemTypeForm, overrideControlPrefix, PageNames.EditQuestion)
 {
     if (overrideControlPrefix != null)
     {
         this.ControlPrefix = overrideControlPrefix;
     }
     InitElements();
 }
        /// <summary>
        /// the constructor
        /// </summary>
        /// <param name="itemTypeForm"></param>
        public EditTaskPage(ItemTypeForm itemTypeForm)
            : base()
        {
            this.Name = MethodBase.GetCurrentMethod().DeclaringType.Name;
            this.PrintName();
            this.ExpectedUrl = "/Assess/Items/EditTask.aspx";
            this.VerifyCurrentUrl();

            this.itemTypeForm = itemTypeForm;
            InitElements();
        }
Beispiel #12
0
 /// <summary>
 /// the create new item form constructor
 /// </summary>
 /// <param name="itemTypeForm">item type form</param>
 /// <param name="overrideControlPrefix">override control prefix</param>
 /// <param name="pageNames">the page name (optional)</param>
 public EditTestItemCreateNewItemForm(ItemTypeForm itemTypeForm, string overrideControlPrefix = null, PageNames pageNames = PageNames.CreateNewItem)
     : base()
 {
     if (overrideControlPrefix != null)
     {
         this.ControlPrefix = overrideControlPrefix;
     }
     ItemTypeForm = itemTypeForm;
     ItemType     = itemTypeForm.ItemType;
     PageNames    = pageNames;
     InitElements();
 }
Beispiel #13
0
 public override void InputFormFields()
 {
     ItemPropertiesForm.InputFormFields();
     StandardPopupDialog = ItemPropertiesForm.StandardLookup();
     //StandardPickerForm.InputAndSubmitForm();
     StandardPopupDialog.Data = Data.StandardPickerData;
     StandardPopupDialog.Form.InputAndSubmitForm();
     ItemTypeForm.Data = Data.ItemTypeData;
     ItemTypeForm.QuestionAnswerDataObject = Data.QuestionAnswerData;
     ItemTypeForm.AutoItDataObject         = Data.AutoItData;
     ItemTypeForm.InputFormFields();
 }
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ItemTypeForm EntityGet()
        {
            ItemTypeForm entity = new ItemTypeForm();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.CLSA       = txtCLSA.Text.Trim();
            entity.CLSB       = txtCLSB.Text.Trim();
            entity.ItemTypeID = SysConvert.ToInt32(drpItemTypeID.EditValue);
            entity.Remark     = txtRemark.Text.Trim();

            return(entity);
        }
Beispiel #15
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ItemTypeForm MasterEntity = (ItemTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_ItemTypeForm(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("CLSA" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CLSA) + ",");
                MasterField.Append("CLSB" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CLSB) + ",");
                MasterField.Append("ItemTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemTypeID) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("DelFlag" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            ItemTypeForm entity = new ItemTypeForm();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtCLSA.Text            = entity.CLSA.ToString();
            txtCLSB.Text            = entity.CLSB.ToString();
            drpItemTypeID.EditValue = entity.ItemTypeID;
            txtRemark.Text          = entity.Remark.ToString();


            if (!findFlag)
            {
            }
        }
Beispiel #17
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ItemTypeForm MasterEntity = (ItemTypeForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_ItemTypeForm SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" CLSA=" + SysString.ToDBString(MasterEntity.CLSA) + ",");
                UpdateBuilder.Append(" CLSB=" + SysString.ToDBString(MasterEntity.CLSB) + ",");
                UpdateBuilder.Append(" ItemTypeID=" + SysString.ToDBString(MasterEntity.ItemTypeID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Beispiel #18
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ItemTypeForm    entity  = (ItemTypeForm)p_BE;
         ItemTypeFormCtl control = new ItemTypeFormCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #19
0
 public override void InputFormFields()
 {
     ItemPropertiesForm.InputFormFields();
     //if not a task item
     if (ItemTypeForm.GetType() != typeof(ItemTypeTaskForm))
     {
         //then select a standard
         StandardPopupDialog      = ItemPropertiesForm.StandardLookup();
         StandardPopupDialog.Data = Data.StandardPickerData;
         StandardPopupDialog.Form.InputAndSubmitForm();
         this.DriverCommands.WaitAndMeasurePageLoadTime();
         InitElements();
         ItemPropertiesForm.Data             = Data.ItemTypeData;
         ItemPropertiesForm.AutoItDataObject = Data.AutoItData;
     }
     ItemTypeForm.Data = Data.ItemTypeData;
     ItemTypeForm.QuestionAnswerDataObject = Data.QuestionAnswerData;
     ItemTypeForm.AutoItDataObject         = Data.AutoItData;
     ItemTypeForm.InputFormFields();
 }
Beispiel #20
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ItemTypeForm entity = (ItemTypeForm)p_BE;
                //string sql = string.Empty;

                //sql = " SELECT 1 FROM  Data_ItemTypeForm WHERE CLSA= " + SysString.ToDBString(entity.CLSA);

                //DataTable dt = SysUtils.Fill(sql);
                //if (dt.Rows.Count != 0)
                //{
                //    throw new Exception("大类已经存在,请重新输入!");
                //}

                //sql = " SELECT 1 FROM  Data_ItemTypeForm WHERE CLSB= " + SysString.ToDBString(entity.CLSB);

                //DataTable dt1 = SysUtils.Fill(sql);
                //if (dt1.Rows.Count != 0)
                //{
                //    throw new Exception("小类已经存在,请重新输入!");
                //}


                ItemTypeFormCtl control = new ItemTypeFormCtl(sqlTrans);
                control.Update(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
        public override void VerifyErrorsForRequiredFields()
        {
            ItemTypeForm.VerifyErrorsForRequiredFields();

            List <string> actualRequiredErrorsList = new List <string>();
            //get the error message element list
            ReadOnlyCollection <IWebElement> messageElements = StepsToCompleteLabels.WaitForElements(5);

            if (StandardPopupDialog != null)
            {
                if (Driver.GetType() == typeof(DummyDriver))
                {
                    messageElements = StandardPopupDialog.Form.GetDummyStepsToCompleteLabels();
                }

                //for each element in the list
                foreach (var messageElement in messageElements)
                {
                    //if the error message element is displayed
                    if (messageElement.Displayed)
                    {
                        string actualMessage = messageElement.Text;
                        //get the error message text and add it to the actual error message list
                        actualRequiredErrorsList.Add(actualMessage);
                        Report.Write("Actual required message: " + actualMessage);
                    }
                }
                //for each expected error message in the list
                foreach (var expectedMessage in StandardPopupDialog.Form.ExpectedRequiredErrorsList)
                {
                    //assert that the expected error message is found in the actual error message list
                    Assert.IsTrue(actualRequiredErrorsList.Contains(expectedMessage),
                                  "The expected required message '" + expectedMessage + "' was not found in the actual required message list.");
                }
            }
        }
Beispiel #22
0
        public override void VerifyErrorsForRequiredFields()
        {
            ItemPropertiesForm.VerifyErrorsForRequiredFields();
            ItemTypeForm.VerifyErrorsForRequiredFields();

            /*
             * List<string> actualRequiredErrorsList = new List<string>();
             * //get the error message element list
             * ReadOnlyCollection<IWebElement> messageElements = StepsToCompleteLabels.WaitForElements(5);
             *
             * if (Driver.GetType() == typeof(DummyDriver))
             * {
             *  messageElements = StandardPickerForm.GetDummyStepsToCompleteLabels();
             * }
             *
             * //for each element in the list
             * foreach (var messageElement in messageElements)
             * {
             *  //if the error message element is displayed
             *  if (messageElement.Displayed)
             *  {
             *      string actualMessage = messageElement.Text;
             *      //get the error message text and add it to the actual error message list
             *      actualRequiredErrorsList.Add(actualMessage);
             *      Debug.WriteLine("Actual required message: " + actualMessage);
             *  }
             * }
             * //for each expected error message in the list
             * foreach (var expectedMessage in StandardPickerForm.ExpectedRequiredErrorsList)
             * {
             *  //assert that the expected error message is found in the actual error message list
             *  Assert.IsTrue(actualRequiredErrorsList.Contains(expectedMessage),
             *      "The expected required message '" + expectedMessage + "' was not found in the actual required message list.");
             * }
             */
        }
Beispiel #23
0
        /// <summary>
        /// Change the item type
        /// </summary>
        /// <param name="itemType">the item type</param>
        public void ChangeItemType(ItemType itemType) // added by Oleg Feb 20, 2014
        {
            string option = null;

            switch (itemType)
            {
            case ItemType.DragAndDrop:
                option = "Drag and Drop";
                break;

            case ItemType.ClickStickClickDrop:
                option = "Click Stick Click Drop";
                break;

            case ItemType.Gridded:
                option = "Gridded";
                break;

            case ItemType.HotSpotMultipleSelection:
                option = "Hot Spot - Multiple Selection";
                break;

            case ItemType.HotSpotSingleSelection:
                option = "Hot Spot - Single Selection";
                break;

            case ItemType.InlineResponse:
                option = "Inline Response";
                break;

            case ItemType.Matching:
                option = "Matching";
                break;

            case ItemType.MultipleChoice:
                option = "Multiple Choice";
                break;

            case ItemType.OpenResponse:
                option = "Open Response";
                break;

            case ItemType.Task:
                option = "Task";
                break;

            case ItemType.TrueFalse:
                option = "True/False";
                break;

            default:
                option = "Select Item Type";
                break;
            }
            if (option != null)
            {
                this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
                Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

                ChangeType_link.Click();
                ChangeItemType_dropdown.Wait(3).SelectByText(option);

                //TODO: this is inconsistent behavior, and I pointed the issue out to Boris
                //  so Boris talked to Product Owners, but won't it be fixed anytime soon
                //  there could be test failures as a side affect
                //if item type is not multiple choice, then handle the pop-up
                if (ItemTypeForm.GetType() != typeof(ItemTypeMultipleChoiceForm))
                {
                    IAlert alert     = Driver.SwitchTo().Alert();
                    string expected1 = "Some content cannot be carried over.";
                    if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                    {
                        ((DummyIAlert)alert).Text = expected1;
                    }
                    string actual = alert.Text;
                    Report.Write("The alert text: '" + actual + "'.");
                    Assert.IsTrue(actual.Contains(expected1), "The delete confirmation pop-up does not contain the expected text: '" + expected1 + "'; actual text: '" + actual + "'.");
                    alert.Accept();

                    //switch to window
                    DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);
                }

                this.DriverCommands.WaitForPageToLoad(60);
            }
            switch (itemType)
            {
            case ItemType.DragAndDrop:
                ItemTypeForm = new ItemTypeDragDropForm();
                break;

            case ItemType.ClickStickClickDrop:
                ItemTypeForm = new ItemTypeDragDropForm();
                break;

            case ItemType.Gridded:
                ItemTypeForm = new ItemTypeGriddedForm();
                break;

            case ItemType.HotSpotMultipleSelection:
                //TODO: add later
                //ItemTypeForm = null;
                break;

            case ItemType.HotSpotSingleSelection:
                //TODO: add later
                //ItemTypeForm = null;
                break;

            case ItemType.InlineResponse:
                ItemTypeForm = new ItemTypeInlineResponseForm();
                break;

            case ItemType.Matching:
                ItemTypeForm = new ItemTypeMatchingForm();
                break;

            case ItemType.MultipleChoice:
                ItemTypeForm = new ItemTypeMultipleChoiceForm();
                break;

            case ItemType.OpenResponse:
                ItemTypeForm = new ItemTypeOpenResponseForm();
                break;

            case ItemType.Task:
                ItemTypeForm = new ItemTypeTaskForm();
                break;

            case ItemType.TrueFalse:
                ItemTypeForm = new ItemTypeTrueFalseForm();
                break;
            }
            //may need to call initElements() if there are problems
            ItemTypeForm.Data = Data.ItemTypeData;
        }
Beispiel #24
0
 public override void VerifyFieldsExist()
 {
     ItemPropertiesForm.VerifyFieldsExist();
     ItemTypeForm.VerifyFieldsExist();
 }
Beispiel #25
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ItemTypeForm entity = (ItemTypeForm)p_BE;
 }
 public void InputFormFields_AnswerKeyOnly()
 {
     ItemTypeForm.InputFormFields_AnswerKeyOnly();
 }