protected void btnReferCollegue_Click(object sender, EventArgs e)
        {
            List<WebinarReferCollegue> objRef = objWebinarDA.GetWebinarReferedCollegueDetail(Convert.ToInt32(hWebinarID.Value), txtCEmail.Text.Trim(), txtEmail.Text.Trim());
            if (objRef.Count > 0)
            {
                dvRAFForm.Visible = false;
                dvRefExist.Visible = true;
                TemplateMgmt objTemplateMgmt = new TemplateMgmt();
                ltrRefExist.Text = objTemplateMgmt.GetReferedCollegueExist(objRef[0].EmailedOn, objRef[0].ReferInitiatedIP, Constant.DocTemplate + "referExist.tpl");
            }
            else
            {
                WebinarReferCollegue objRefData = new WebinarReferCollegue();
                objRefData.RefererFirstName = txtFName.Text.Trim();
                objRefData.RefererLastName = txtLName.Text.Trim();
                objRefData.RefererEmail = txtEmail.Text.Trim();
                objRefData.CollegueFirstName = txtCFName.Text.Trim();
                objRefData.CollegueLastName = txtCLName.Text.Trim();
                objRefData.CollegueEmail = txtCEmail.Text.Trim();

                objRefData.WebinarID = Convert.ToInt32(hWebinarID.Value);
                objRefData.ReferInitiatedIP = Request.UserHostAddress;
                int eventRefID = objWebinarDA.SaveWebinarReferCollegue(objRefData);
                phRegFormColleague.Visible = false;
                if (hphReg.Value == "1")
                    phAll.Visible = true;
                else
                    phOpt1.Visible = true;
                //btnRefCol1.Visible = true;
                //TemplateMgmt objTemplateMgmt = new TemplateMgmt();
                //ltrRefConf.Text = objTemplateMgmt.GetReferedCollegueConfirm(Constant.DocTemplate + "refConfirm.tpl");

            }
        }
Example #2
0
        public int SaveWebinarReferCollegue(WebinarReferCollegue objRefData)
        {
            int webEventRefID = 0;
            try
            {
                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {
                    MySqlCommand sqlCmd = new MySqlCommand(DBQuery.sqlInsertReferColleque, sqlCon);
                    sqlCon.Open();
                    sqlCmd.CommandType = CommandType.Text;
                    sqlCmd.Parameters.Add(new MySqlParameter("@webinarID", objRefData.WebinarID));
                    sqlCmd.Parameters.Add(new MySqlParameter("@colleaguefirstname", objRefData.CollegueFirstName));
                    sqlCmd.Parameters.Add(new MySqlParameter("@colleaguelastname", objRefData.CollegueLastName));
                    sqlCmd.Parameters.Add(new MySqlParameter("@colleagueemailID", objRefData.CollegueEmail));
                    sqlCmd.Parameters.Add(new MySqlParameter("@refererfirstname", objRefData.RefererFirstName));
                    sqlCmd.Parameters.Add(new MySqlParameter("@refererlastname", objRefData.RefererLastName));
                    sqlCmd.Parameters.Add(new MySqlParameter("@refereremailID", objRefData.RefererEmail));
                    sqlCmd.Parameters.Add(new MySqlParameter("@referInitiatedIP", objRefData.ReferInitiatedIP));
                    sqlCmd.ExecuteNonQuery();

                    sqlCmd = new MySqlCommand("SELECT LAST_INSERT_ID()", sqlCon);
                    sqlCmd.CommandType = CommandType.Text;

                    MySqlDataReader reader = sqlCmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        webEventRefID = Convert.ToInt32(reader.GetValue(0));
                    }
                    reader.Close();
                    reader = null;
                    sqlCon.Close();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return webEventRefID;
        }