protected void LnkBtnAnswer_Click(object sender, EventArgs e)
 {
     DivAddAnswerModal.Visible = true;
     if (Question_Answer.GetQuestion_AnswerRecords("QuestionId=" + QuestionID).Rows.Count > 0)
     {
         TxtAnswer.Text = Question_Answer.GetQuestion_AnswerRecords("QuestionId=" + QuestionID).Rows[0]["Answer"].ToString();
     }
     TxtAnswer.Focus();
     this.Page.Form.DefaultButton = BtnAddAnswer.UniqueID;
 }
Esempio n. 2
0
        private void BtnStart_Click(object sender, EventArgs e)
        {
            //ラジオボタンで問題数の変更を行う。
            //問題数が10問
            if (Rdb10.Checked)
            {
                queMax = 10;
            }
            //問題数が20問
            if (Rdb20.Checked)
            {
                queMax = 20;
            }
            //問題数が30問
            if (Rdb30.Checked)
            {
                queMax = 30;
            }
            //問題数が40問
            if (Rdb40.Checked)
            {
                queMax = 40;
            }

            //ラジオボタンで計算の種類を変更する。
            //足し算が選択状態
            if (RdbNum.Checked)
            {
                type    = 1;
                typeStr = "+";
            }
            //引き算が選択状態
            if (RdbSub.Checked)
            {
                type    = 2;
                typeStr = "-";
            }
            //割り算が選択状態
            if (RdbMul.Checked)
            {
                type    = 3;
                typeStr = "*";
            }

            queCnt = 0;
            corCnt = 0;
            MondaiSakusei();
            //解答欄を入力可にする
            TxtAnswer.Enabled = true;
            //解答欄にフォーカスを移す
            TxtAnswer.Focus();
        }
Esempio n. 3
0
        /// <summary>
        /// Take the text (if there is any) from the text box and save it to the text file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void BtnSubmitResponse_Click(object sender, EventArgs e)
        {
            //Tests text box to ensure it isn't blank
            if (TxtAnswer.Text != "")
            {
                // Make a string variable from the text box
                string answer = $"{TxtAnswer.Text}";
                //Add the answer to the answer list
                ListBoxAnswers.Items.Add(answer);
                //Sort the list box for fun
                ListBoxAnswers.Sorted = true;
                //Save the file
                SaveAnswersList(answer);
                //Confirm Submission
                MessageBox.Show($"Thank you for entering {TxtAnswer.Text}");
                //Clearsthe text box
                TxtAnswer.Clear();
                //Focuses on the text box
                TxtAnswer.Focus();
            }
        }
Esempio n. 4
0
 private void Window_ContentRendered(object sender, EventArgs e)
 {
     TxtAnswer.SelectAll();
     TxtAnswer.Focus();
 }
Esempio n. 5
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (TxtUserId.Text.Length == 0)
            {
                // LblMsg.Text = "User Id Is Blank, Enter Valid User Id....";
                TxtUserId.Focus();
                return;
            }

            if (TxtUserName.Text.Length == 0)
            {
                // LblMsg.Text = "User Name Is Blank, Enter Valid User Name....";
                TxtUserName.Focus();
                return;
            }

            if (TxtLoginName.Text.Length == 0)
            {
                //LblMsg.Text = "Login Name Is Blank, Enter Valid Login Name....";
                TxtLoginName.Focus();
                return;
            }

            if (DDLUserGroup.SelectedValue == "0")
            {
                //LblMsg.Text = "Select User Group....";
                DDLUserGroup.Focus();
                return;
            }

            if (TxtDOB.Text.Length == 0)
            {
                //LblMsg.Text = "DOB Is Blank, Enter Valid Brith Date....";
                TxtDOB.Focus();
                return;
            }

            if (TxtEMailId.Text.Length == 0)
            {
                //LblMsg.Text = "EMail Id Is Blank, Enter Valid EMail Id....";
                TxtEMailId.Focus();
                return;
            }

            if (TxtMobNo.Text.Length == 0)
            {
                //LblMsg.Text = "Mob.No Is Blank, Enter Valid Mob.No....";
                TxtMobNo.Focus();
                return;
            }

            if (TxtPassword.Text.Length == 0)
            {
                //LblMsg.Text = "Password Is Blank, Enter Valid Password....";
                TxtPassword.Focus();
                return;
            }

            if (TxtQuestion.Text.Length == 0)
            {
                //LblMsg.Text = "Question Is Blank, Enter Valid Question....";
                TxtQuestion.Focus();
                return;
            }

            if (TxtAnswer.Text.Length == 0)
            {
                //LblMsg.Text = "Answer Is Blank, Enter Valid Answer....";
                TxtAnswer.Focus();
                return;
            }

            StrSql        = new StringBuilder();
            StrSql.Length = 0;


            if (HidFldId.Value.Length == 0)
            {
                StrSql.AppendLine("Insert Into User_Mast (UId,UserName,LoginName");
                StrSql.AppendLine(",UserGroup,Password ");
                StrSql.AppendLine(",Gender,EMailId,DOB");
                StrSql.AppendLine(",CountryId,StateId,CityId");
                StrSql.AppendLine(",MobNo,Phone");
                StrSql.AppendLine(",Question,Answer");
                StrSql.AppendLine(",Activation");
                StrSql.AppendLine(",Entry_Date,Entry_Time");
                StrSql.AppendLine(",Entry_UID,UPDFLAG)");

                StrSql.AppendLine("Values(@UserId,@UserName,@LoginName");
                StrSql.AppendLine(",@UserGroup,@Password ");
                StrSql.AppendLine(",@Gender,@EMailId,@DOB");
                StrSql.AppendLine(",@CountryId,@StateId,@CityId");
                StrSql.AppendLine(",@MobNo,@Phone");
                StrSql.AppendLine(",@Question,@Answer");
                StrSql.AppendLine(",@Activation");
                StrSql.AppendLine(",GetDate(),Convert(VarChar,GetDate(),108)");
                StrSql.AppendLine(",@Entry_UID,0)");
            }
            else
            {
                StrSql.AppendLine("Update User_Mast Set UId=@UserId,UserName=@UserName,LoginName=@LoginName");
                StrSql.AppendLine(",UserGroup=@UserGroup,Password=@Password ");
                StrSql.AppendLine(",Gender=@Gender,EMailId=@EMailId,DOB=@DOB");
                StrSql.AppendLine(",CountryId=@CountryId,StateId=@StateId,CityId=@CityId");
                StrSql.AppendLine(",MobNo=@MobNo,Phone=@Phone");
                StrSql.AppendLine(",Question=@Question,Answer=@Answer");
                StrSql.AppendLine(",Activation=@Activation");
                StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)");
                StrSql.AppendLine(",MEntry_UID=@Entry_UID,UPDFLAG=IsNull(UPDFlag,0)+1");
                StrSql.AppendLine("Where Id=@Id");
            }

            Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn);
            Cmd.Parameters.AddWithValue("@UserId", TxtUserId.Text.Trim());
            Cmd.Parameters.AddWithValue("@UserName", TxtUserName.Text.Trim());
            Cmd.Parameters.AddWithValue("@LoginName", TxtLoginName.Text.Trim());
            Cmd.Parameters.AddWithValue("@UserGroup", DDLUserGroup.SelectedValue);
            Cmd.Parameters.AddWithValue("@Password", Sec.Encrypt(TxtPassword.Text.Trim()));
            Cmd.Parameters.AddWithValue("@Gender", rblGender.SelectedValue);
            Cmd.Parameters.AddWithValue("@EMailId", TxtEMailId.Text.Trim());

            Cmd.Parameters.AddWithValue("@DOB", ValueConvert.ConvertDate(TxtDOB.Text));

            if (ddlCountry.SelectedValue != "0")
            {
                Cmd.Parameters.AddWithValue("@CountryId", ddlCountry.SelectedValue);
            }
            else
            {
                Cmd.Parameters.AddWithValue("@CountryId", DBNull.Value);
            }
            if (ddlState.SelectedValue != "0")
            {
                Cmd.Parameters.AddWithValue("@StateId", ddlState.SelectedValue);
            }
            else
            {
                Cmd.Parameters.AddWithValue("@StateId", DBNull.Value);
            }
            if (ddlCity.SelectedValue != "0")
            {
                Cmd.Parameters.AddWithValue("@CityId", ddlCity.SelectedValue);
            }
            else
            {
                Cmd.Parameters.AddWithValue("@CityId", DBNull.Value);
            }
            Cmd.Parameters.AddWithValue("@MobNo", TxtMobNo.Text.Trim());
            Cmd.Parameters.AddWithValue("@Phone", TxtPhone.Text.Trim());
            Cmd.Parameters.AddWithValue("@Question", TxtQuestion.Text.Trim());
            Cmd.Parameters.AddWithValue("@Answer", TxtAnswer.Text.Trim());
            Cmd.Parameters.AddWithValue("@Activation", 0);
            Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString());

            if (HidFldId.Value.Length == 0)
            {
                SqlFunc.ExecuteNonQuery(Cmd);
                LblMsg.Text = "User added successfully";
            }
            else
            {
                Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString());

                SqlFunc.ExecuteNonQuery(Cmd);
                LblMsg.Text = "User updated successfully";
            }


            FillGrid();

            ClearAll();

            MyMenu.Items[0].Selected    = true;
            MyMenu.Items[0].ImageUrl    = "~/Images/ViewEnable.jpg";
            MyMultiView.ActiveViewIndex = 0;
            MyMenu.Items[1].ImageUrl    = "~/Images/NewOrEditDisable.jpg";
        }
        catch (Exception ex)
        {
            Response.Write(ex);
        }
    }