protected void btn_Submit_Click(object sender, EventArgs e) { string id; string sql, cnt, pass, user; user = c1.Clean(txt_Question_Title.Text); pass = c1.Clean(txt_Url.Text); if (lbl_Opr.Text == "Add") { sql = "insert into tbl_Notification (Notification,Url,NDate,enablestatus,AdminID) Output Inserted.Id1 values('" + txt_Question_Title.Text + "','" + txt_Url.Text + "','" + txt_Date.Text + "',1,'" + Session["AdminId"].ToString() + "')"; id = c1.SelectScalar(sql); txt_Question_Title.Text = ""; txt_Url.Text = ""; txt_Date.Text = ""; lbl_Msg.Text = "Admin Added Successfully"; } else { sql = "UPDATE tbl_Notification SET Notification='" + txt_Question_Title.Text + "', Url='" + txt_Url.Text + "',"; sql = sql + " NDate='" + txt_Date.Text + "'"; sql = sql + " WHERE Id1=" + lbl_Id.Text; c1.ExecuteQry(sql); txt_Question_Title.Text = ""; txt_Url.Text = ""; txt_Date.Text = ""; FillSubject(); MultiView1.ActiveViewIndex = 0; } }
private void UploadResume() { string sql, ext, fn, path, ResumeContent = ""; int i; if (FU_Resume.HasFile) { fn = FU_Resume.FileName; i = fn.LastIndexOf("."); ext = fn.Substring(i, fn.Length - i); path = Server.MapPath("CandidateResumes"); path = path + "\\" + Session["MemberId"].ToString() + ext; FU_Resume.SaveAs(path); ResumeContent = ExtractTextFromPdf(Server.MapPath("CandidateResumes/" + Session["MemberId"].ToString() + ext)); ResumeContent = c1.Clean(ResumeContent); sql = "UPDATE tbl_Member SET Resume_Url='CandidateResumes/" + Session["MemberId"].ToString() + ext + "',"; sql = sql + " ResumeContent='" + ResumeContent + "'"; sql = sql + " WHERE MemberId=" + Session["MemberId"].ToString(); c1.ExecuteQry(sql); sql = "DELETE FROM tbl_MemberSkills WHERE MemberId=" + Session["MemberId"].ToString() + ";"; sql = sql + "INSERT INTO tbl_MemberSkills (MemberId, SkillId) SELECT '" + Session["MemberId"].ToString() + "', SkillId FROM tbl_Skills where '" + ResumeContent + "' LIKE '%'+SkillName+'%'"; c1.ExecuteQry(sql); } }
protected void btn_Submit_Click1(object sender, EventArgs e) { string sql, cnt, pass, user; user = c1.Clean(txt_Email_Id.Text); pass = c1.Clean(txt_Password.Text); sql = "SELECT count(*) FROM tbl_AdminLogin WHERE LoginId='" + user + "' AND Password='******'"; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 0) { lbl_Msg.Text = "Either Login Id or Password is Wrong"; } else { c1.SetAdminLoginDetails(user); Response.Redirect("Admin_Home.aspx"); } }
protected void btn_Submit_Login_Click(object sender, EventArgs e) { string sql = "", cnt, path; sql = " SELECT Count(*) FROM tbl_Member WHERE EmailId='" + c1.Clean(txt_EmailId_Login.Text) + "'"; sql = sql + " AND Password='******'"; sql = sql + " AND EnableStatus=1"; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 1) { c1.SetLoginDetails(txt_EmailId_Login.Text); if (Session["RefUrl"] != null) { path = Session["RefUrl"].ToString(); if (Session["RefUrl"].ToString() == "TakeExam") { Session.Remove("RefUrl"); Response.Redirect("Test_Insturction.aspx"); //ScriptManager.RegisterStartupScript(this, typeof(string), "New_Window", "window.open( 'TakeExamI.aspx', null, 'resizable=no,height=800,width=1280,status=no,toolbar=no,menubar=no,location=no' );", true); } else { Session.Remove("RefUrl"); Response.Redirect(path); } } else { Response.Redirect("Default.aspx"); } //lbl_Msg.Text = "Success"; } else { lbl_Msg_Login.Text = "Either Email Id / Password is Wrong or Not Activated."; } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, fn, path, id, ext; string isQueImage = "No"; string isQueText = "No"; string isExpImage = "No"; string isExpText = "No"; if (lbl_Opr.Text == "Add") { if (opt_QuestionType.SelectedIndex == 0) { isQueImage = "Yes"; isQueText = "No"; } else { isQueImage = "No"; isQueText = "Yes"; } if (opt_ExplanationType.SelectedIndex == 0) { isExpImage = "Yes"; isExpText = "No"; } else { isExpImage = "No"; isExpText = "Yes"; } if (isQueImage == "Yes") { if (!FU_Question.HasFile) { lbl_Msg.Text = "Select Question Image"; return; } } if (isExpImage == "Yes") { if (!FU_Explanation.HasFile) { lbl_Msg.Text = "Select Explanation Image"; return; } } sql = "insert into tbl_Question (Question_Type, Explanation_Type, Question_Text, Explanation_Text, QuestionCategoryId,Answer,Question_Title) Output Inserted.QuestionId values "; sql = sql + " ('Text','Text','" + c1.Clean(txt_QuestionText.Content) + "','" + c1.Clean(txt_Explanation.Content) + "',"; sql = sql + " '" + ddl_CategoryAdd.SelectedValue.ToString() + "','" + txt_Answer.Text + "','" + txt_QuestionNo.Text + "')"; id = c1.SelectScalar(sql); if (isQueImage == "Yes") { if (FU_Question.HasFile) { UploadPhoto(FU_Question, id, "tbl_Question", "Question_Url", "Questions", "Question_Type"); } } if (isExpImage == "Yes") { if (FU_Explanation.HasFile) { UploadPhoto(FU_Explanation, id, "tbl_Question", "Explanation_Url", "QuestionExplain", "Explanation_Type"); } } txt_QuestionText.Content = ""; txt_Explanation.Content = ""; txt_QuestionNo.Text = ""; txt_Answer.Text = ""; lbl_Msg.Text = "Question Added Successfully"; } else { id = lbl_Id.Text; if (opt_QuestionType.SelectedIndex == 0) { isQueText = "No"; if (FU_Question.HasFile) { UploadPhoto(FU_Question, id, "tbl_Question", "Question_Url", "Questions", "Question_Type"); sql = "UPDATE tbl_Question set Question_Text='' "; sql = sql + " where QuestionId=" + lbl_Id.Text; c1.ExecuteQry(sql); } else { lbl_Msg.Text = "Select Question Image "; } } else { isQueText = "Yes"; } if (opt_ExplanationType.SelectedIndex == 0) { isExpText = "No"; if (FU_Explanation.HasFile) { UploadPhoto(FU_Explanation, id, "tbl_Question", "Explanation_Url", "QuestionExplain", "Explanation_Type"); sql = "UPDATE tbl_Question set Explanation_Text='' "; sql = sql + " where QuestionId=" + lbl_Id.Text; c1.ExecuteQry(sql); } else { lbl_Msg.Text = "Select Explanation Image "; } } else { isExpText = "Yes"; } sql = "UPDATE tbl_Question set "; sql = sql + " QuestionCategoryId='" + ddl_CategoryAdd.SelectedValue.ToString() + "', "; sql = sql + " Question_Title='" + txt_QuestionNo.Text + "', "; sql = sql + " Answer='" + txt_Answer.Text + "' "; if (isQueText == "Yes") { sql = sql + " ,Question_Type='Text', Question_Url='', Question_Text ='" + txt_QuestionText.Content + "' "; } if (isExpText == "Yes") { sql = sql + " ,Explanation_Type='Text', Explanation_Url='', Explanation_Text ='" + txt_Explanation.Content + "' "; } sql = sql + " where QuestionId=" + lbl_Id.Text; c1.ExecuteQry(sql); } }
protected void btn_Submit_Click(object sender, EventArgs e) { { string sql, fn, path, id, ext; if (lbl_Opr.Text == "Add") { if (opt_QuestionType.SelectedIndex == 0) { if (FU_Question.HasFile) { sql = "insert into tbl_TestInstruction (InstructionType,Title,AdminId) values "; sql = sql + " ('Image','" + txt_Title.Text + "','" + Session["AdminId"].ToString() + "') "; c1.ExecuteQry(sql); sql = "SELECT MAX(Id1) FROM tbl_TestInstruction "; id = c1.SelectScalar(sql); fn = FU_Question.FileName; ext = fn.Substring(fn.LastIndexOf("."), fn.Length - fn.LastIndexOf(".")); fn = id + ext; path = Server.MapPath("../TestInstruction"); path = path + "\\" + id + ext; FU_Question.SaveAs(path); sql = "UPDATE tbl_TestInstruction SET PhotoUrl ='TestInstruction/" + id + ext + "' "; sql = sql + " WHERE Id1=" + id; c1.ExecuteQry(sql); txt_QuestionText.Content = ""; txt_Title.Text = ""; lbl_Msg.Text = "Instruction Added Successfully"; } else { lbl_Msg.Text = "Select File to Upload"; } } else { sql = "insert into tbl_TestInstruction (InstructionType,TestInstruction,Title,AdminId) values("; sql = sql + "'Text','" + c1.Clean(txt_QuestionText.Content) + "','" + txt_Title.Text + "','" + Session["AdminId"].ToString() + "') "; c1.ExecuteQry(sql); txt_QuestionText.Content = ""; txt_Title.Text = ""; lbl_Msg.Text = "Question Added Successfully"; } } else { if (opt_QuestionType.SelectedIndex == 0) { if (FU_Question.HasFile) { id = lbl_Id.Text; fn = FU_Question.FileName; ext = fn.Substring(fn.LastIndexOf("."), fn.Length - fn.LastIndexOf(".")); fn = id + ext; path = Server.MapPath("../TestInstruction"); path = path + "\\" + id + ext; FU_Question.SaveAs(path); sql = "UPDATE tbl_TestInstruction set "; sql = sql + " InstructionType='Image',TestInstruction='', "; sql = sql + " PhotoUrl ='TestInstruction/" + id + ext + "', "; sql = sql + " Title='" + txt_Title.Text + "'"; sql = sql + " where Id1=" + lbl_Id.Text; c1.ExecuteQry(sql); } else { sql = "UPDATE tbl_TestInstruction set "; sql = sql + " Title='" + txt_Title.Text + "'"; sql = sql + " where Id1=" + lbl_Id.Text; c1.ExecuteQry(sql); } } else { sql = "UPDATE tbl_TestInstruction set "; sql = sql + " InstructionType='Text',PhotoUrl='',"; sql = sql + " TestInstruction ='" + c1.Clean(txt_QuestionText.Content) + "', "; sql = sql + " Title='" + txt_Title.Text + "'"; sql = sql + " where Id1=" + lbl_Id.Text; c1.ExecuteQry(sql); } txt_QuestionText.Content = ""; txt_Title.Text = ""; FillPaper(); MultiView1.ActiveViewIndex = 0; } } }