예제 #1
0
        public string InsertWebinarFormQA(WebinarRegFormQA objWebinarRegFormQA)
        {
            string rtn = string.Empty;
            try
            {
                //string sql1 = "";
                //if (objWebinarRegFormQA.qaID == 0)
                //    sql1 = DBQuery.sqlWebinarRegistrantFormQAInsert;
                //else
                //    sql1 = DBQuery.sqlWebinarRegistrantFormQAUpdate;

                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {
                    MySqlCommand sqlCmd = new MySqlCommand("spAddUpdateAdditionalRegQ", sqlCon);
                    sqlCon.Open();
                    sqlCmd.CommandType = CommandType.StoredProcedure;
                    sqlCmd.Parameters.Add(new MySqlParameter("pQaID", objWebinarRegFormQA.qaID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pWebinarID", objWebinarRegFormQA.webinarID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pRegFormQuestion", objWebinarRegFormQA.RegFormQuestion));
                    sqlCmd.Parameters.Add(new MySqlParameter("pQResponseType", objWebinarRegFormQA.QResponseType));
                    sqlCmd.Parameters.Add(new MySqlParameter("pQResponseOptions", objWebinarRegFormQA.QResponseOptions));
                    MySqlDataReader reader = sqlCmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        rtn = (reader[0] == DBNull.Value ? string.Empty : Convert.ToString(reader[0]));
                    }
                    reader.Close();
                    reader = null;
                    sqlCon.Close();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return rtn;
        }
예제 #2
0
        protected void btnAddQuestion_click(object sender, EventArgs e)
        {
            string errString = "";
            string sRespOpt = "";
            errLbl.Text = "";
            if (txtQuestion.Text.Trim() == "")
                errString = "Question cannot be empty";
            if (errString == "")
            {
                if (rcmbType.SelectedValue != "COMM")
                {
                    TextBox txt;
                    for (int idx = 1; idx < 6; idx++)
                    {
                        txt = (TextBox)this.FindControl("txtRespone" + idx.ToString());
                        if (txt != null)
                        {
                            if (txt.Text.Trim() != "")
                                sRespOpt += txt.Text.Trim() + ";";
                        }
                    }
                    if (sRespOpt != "")
                        sRespOpt = sRespOpt.Substring(0, sRespOpt.Length - 1);
                }
                if (rcmbType.SelectedValue != "COMM" && sRespOpt == "")
                    if (errString == "")
                        errString = "Atleast one response should be entered";
                    else
                        errString = "Question cannot be empty and at least one response should be entered";

            }
            if (errString == "")
            {
                WebinarRegFormQA objWebinarRegFormQA = new WebinarRegFormQA();
                objWebinarRegFormQA.qaID = Convert.ToInt32(hqaID.Value);
                objWebinarRegFormQA.QResponseOptions = sRespOpt;
                objWebinarRegFormQA.QResponseType = rcmbType.SelectedValue;
                objWebinarRegFormQA.QuestionOrder = Convert.ToInt32(hQOrder.Value);
                objWebinarRegFormQA.RegFormQuestion = txtQuestion.Text.Trim();
                objWebinarRegFormQA.webinarID = Convert.ToInt32(hWebinarID.Value);
                errLbl.Text = objWebinarDA.InsertWebinarFormQA(objWebinarRegFormQA);
                if (errLbl.Text == "Success")
                {
                    popQAs();
                    btnEditCancel_click(null, null);
                }
                //clearQuestionFields();
            }
        }