protected void btn_Submit_Click(object sender, EventArgs e) { string sql, fn, path, id, ext; if (lbl_Opr.Text == "Add") { sql = "insert into tbl_Skills (EnableStatus,SkillName, SkillWeight,AdminId) values(1,'" + txt_Question_Title.Text + "', '"; sql = sql + txt_Weight.Text + "','"; sql = sql + Session["AdminId"].ToString() + "')"; c1.ExecuteQry(sql); txt_Question_Title.Text = ""; txt_Weight.Text = ""; lbl_Msg.Text = "Q Section Added Successfully"; } else { sql = "UPDATE tbl_Skills SET SkillName='" + txt_Question_Title.Text + "', "; sql = sql + " SkillWeight=" + txt_Weight.Text; sql = sql + " WHERE SkillId=" + lbl_Id.Text; c1.ExecuteQry(sql); txt_Weight.Text = ""; txt_Question_Title.Text = ""; FillCategory(); MultiView1.ActiveViewIndex = 0; } }
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; } }
protected void lnk_SelectAll_Click(object sender, EventArgs e) { string sql; sql = "update tbl_Member set ShortListed=1 "; c1.ExecuteQry(sql); fill(); }
protected void linkDelete_Click(object sender, EventArgs e) { string sql; sql = "Delete from tbl_PaperSet where PaperId=" + ddl_PaperAdd.SelectedValue.ToString(); c1.ExecuteQry(sql); FillQuestion(); }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, cnt; if (lbl_Opr.Text == "Edit") { sql = "UPDATE tbl_Member SET "; sql = sql + " MemberName='" + txt_MemberName.Text + "',"; sql = sql + " EmailId='" + txt_EmailID.Text + "',"; sql = sql + " ContactNo='" + txt_ContactNo.Text + "'"; sql = sql + " WHERE MemberId=" + lbl_Id.Text; c1.ExecuteQry(sql); txt_ContactNo.Text = ""; txt_EmailID.Text = ""; txt_MemberName.Text = ""; txt_Password.Text = ""; MultiView1.ActiveViewIndex = 0; } if (lbl_Opr.Text == "Add") { sql = " SELECT Count(*) FROM tbl_Member WHERE EmailId='" + txt_EmailID.Text + "'"; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 1) { lbl_Msg_Reg.Text = "This EmailId is Already Registered."; } else { sql = " INSERT INTO tbl_Member (EnableStatus,MemberName, EmailId,Password,ContactNo,RegDate)"; sql = sql + "VALUES ( 0,"; sql = sql + " '" + txt_MemberName.Text + "',"; sql = sql + " '" + txt_EmailID.Text + "',"; sql = sql + " '" + txt_Password.Text + "',"; sql = sql + " '" + txt_ContactNo.Text + "',"; sql = sql + " '" + DateTime.Now.ToShortDateString() + "')"; c1.ExecuteQry(sql); txt_ContactNo.Text = ""; txt_EmailID.Text = ""; txt_MemberName.Text = ""; txt_Password.Text = ""; FillSubject(); MultiView1.ActiveViewIndex = 0; } } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql; sql = "update tbl_AboutUs set AboutUs='" + txt_Editor.Content + "'"; c1.ExecuteQry(sql); }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, cnt; sql = " SELECT Count(*) FROM tbl_Member WHERE MemberId='" + Session["MemberId"].ToString() + "'"; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 1) { sql = " Update tbl_Member set MemberName='" + txt_Name.Text + "',"; sql = sql + "ContactNo='" + txt_ContactNo.Text + "'"; sql = sql + " Where MemberId='" + Session["MemberId"].ToString() + "'"; c1.ExecuteQry(sql); lbl_Msg.Text = "Profil Update SucessFully"; } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, cnt; sql = " SELECT Count(*) FROM tbl_Member WHERE EmailId='" + txt_EmailId.Text + "'"; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 1) { lbl_Msg_Reg.Text = "This EmailId is Already Registered."; } else { sql = " INSERT INTO tbl_Member (MemberName, EmailId, ContactNo, Password, RegDate,EnableStatus) VALUES ("; sql = sql + " '" + txt_MemberName.Text + "',"; sql = sql + " '" + txt_EmailId.Text + "',"; sql = sql + " '" + txt_ContactNo.Text + "',"; sql = sql + " '" + txt_Password.Text + "',"; sql = sql + " '" + DateTime.Now.ToShortDateString() + "',1)"; c1.ExecuteQry(sql); //c1.SetLoginDetails(txt_EmailId.Text); txt_ContactNo.Text = ""; txt_EmailId.Text = ""; txt_MemberName.Text = ""; txt_Password.Text = ""; txt_ConfirmPassword.Text = ""; lbl_Msg_Reg.Text = "Registration Completed Successfully."; } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql; if (lbl_Opr.Text == "Edit") { sql = "UPDATE tbl_JobPost SET "; sql = sql + "Title='" + txt_Title.Text + "',"; sql = sql + "Skills='" + txt_Skills.Text + "',"; sql = sql + "Salary='" + txt_Sallery.Text + "',"; sql = sql + "Qualification='" + txt_Qualification.Text + "',"; sql = sql + "Experience='" + txt_Experience.Text + "',"; sql = sql + "Description='" + txt_Description.Text + "',"; sql = sql + "PostDate='" + txt_PostDate.Text + "',"; sql = sql + "LastDate='" + txt_LastDate.Text + "'"; sql = sql + " WHERE JobId=" + lbl_Id.Text; c1.ExecuteQry(sql); Filljobs(); MultiView1.ActiveViewIndex = 0; } if (lbl_Opr.Text == "Add") { sql = " INSERT INTO tbl_JobPost (Title,Skills,Salary,Qualification,Experience,Description,PostDate,LastDate,AdminId)"; sql = sql + "VALUES("; sql = sql + " '" + txt_Title.Text + "',"; sql = sql + " '" + txt_Skills.Text + "',"; sql = sql + " '" + txt_Sallery.Text + "',"; sql = sql + " '" + txt_Qualification.Text + "',"; sql = sql + " '" + txt_Experience.Text + "',"; sql = sql + " '" + txt_Description.Text + "',"; sql = sql + " '" + txt_PostDate.Text + "',"; sql = sql + " '" + txt_LastDate.Text + "',"; sql = sql + " '" + Session["AdminId"] + "')"; c1.ExecuteQry(sql); txt_Title.Text = ""; txt_Skills.Text = ""; txt_Sallery.Text = ""; txt_Qualification.Text = ""; txt_Experience.Text = ""; txt_Description.Text = ""; txt_PostDate.Text = ""; txt_LastDate.Text = ""; Filljobs(); MultiView1.ActiveViewIndex = 0; } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql; sql = "update tbl_CompanyInfo set CPhone='" + txt_Phone.Content + "',"; sql = sql + " CEmail='" + txt_Email.Content + "',"; sql = sql + " CAddress='" + txt_Address.Content + "'"; c1.ExecuteQry(sql); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { string str, id; id = ((Label)Repeater1.Items[e.Item.ItemIndex].FindControl("lbl_Id")).Text; if (e.CommandName == "Delete") { str = "delete from tbl_ContactUs where ID1=" + id; c1.ExecuteQry(str); FillSubject(); } }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, fn, path, id, ext; if (ddl_SubjectAdd.SelectedIndex > 0) { if (grd_Category.Rows.Count != 0) { if (lbl_Opr.Text == "Add") { sql = "insert into tbl_paper (PaperName, SubjectId,InstructionId,FixPaper, Description, MinTime, QuestionMarks, NegativeMarks, EnableStatus, AdminId)"; sql = sql + " Output Inserted.PaperId values('" + txt_PaperName.Text + "','" + ddl_SubjectAdd.SelectedValue.ToString() + "','" + ddl_InstructionAdd.SelectedValue.ToString() + "', '" + dl_PaperType.SelectedValue.ToString() + "','" + txt_Description.Text + "','" + txt_PaperTime.Text + "', '" + txt_QuestionMarks.Text + "','" + txt_NegativeMarks.Text + "', '0','" + Session["AdminId"].ToString() + "')"; id = c1.SelectScalar(sql); savePaperQuestionCategory(id); clearTextboxes(); grd_Category.DataSource = null; grd_Category.DataBind(); lbl_Msg.Text = "Paper Added Successfully"; } else { sql = "UPDATE tbl_paper SET PaperName='" + txt_PaperName.Text + "',"; sql = sql + " SubjectId='" + ddl_SubjectAdd.SelectedValue.ToString() + "',"; sql = sql + " FixPaper='" + dl_PaperType.SelectedValue.ToString() + "',"; sql = sql + " Description='" + txt_Description.Text + "',"; sql = sql + " MinTime='" + txt_PaperTime.Text + "',"; sql = sql + " QuestionMarks='" + txt_QuestionMarks.Text + "',"; sql = sql + " InstructionId='" + ddl_InstructionAdd.SelectedValue.ToString() + "',"; sql = sql + " NegativeMarks='" + txt_NegativeMarks.Text + "'"; sql = sql + " WHERE paperId=" + lbl_Id.Text; c1.ExecuteQry(sql); savePaperQuestionCategory(lbl_Id.Text); clearTextboxes(); grd_Category.DataSource = null; grd_Category.DataBind(); FillPaper(); MultiView1.ActiveViewIndex = 0; } } else { lbl_Msg.Text = "Please Insert Q Section"; } } else { lbl_Msg.Text = "Please Select Category/Subcategory"; } }
//private void FillDetails() //{ // string sql; // DataSet ds = new DataSet(); // sql = "SELECT * FROM tbl_CompanyInfo "; // ds = c1.SelectDs(sql); // if (ds.Tables[0].Rows.Count > 0) // { // lbl_Phone.Text = ds.Tables[0].Rows[0]["CPhone"].ToString(); // lbl_MailUs.Text = ds.Tables[0].Rows[0]["CEmail"].ToString(); // lbl_Address.Text = ds.Tables[0].Rows[0]["CAddress"].ToString(); // } //} protected void btn_Submit_Click(object sender, EventArgs e) { string sql; sql = " INSERT INTO tbl_ContactUs (CName, EmailId, Message, Subject, PhoneNo) VALUES ("; sql = sql + "'" + txt_Name.Text + "',"; sql = sql + "'" + txt_EmailId.Text + "',"; sql = sql + "'" + txt_Message.Text + "',"; sql = sql + "'" + txt_Subject.Text + "',"; sql = sql + "'" + txt_Phone.Text + "')"; c1.ExecuteQry(sql); lbl_Msg.Text = "Your Request Sbumitted Successfully. Our Executives will contact you soon."; txt_EmailId.Text = ""; txt_Name.Text = ""; txt_Message.Text = ""; txt_Subject.Text = ""; txt_Phone.Text = ""; }
protected void btn_Submit_Click(object sender, EventArgs e) { string sql, cnt; sql = "SElECT count(*) from tbl_Member WHERE EmailId='" + Session["EmailId"] + "' AND Password='******' "; cnt = c1.SelectScalar(sql); if (Convert.ToInt32(cnt) == 1) { sql = "UPDATE tbl_Member SET Password='******'"; sql = sql + " WHERE MemberId=" + Session["MemberId"]; c1.ExecuteQry(sql); lbl_Msg.Text = "Your Password Has Changed."; txt_OldPassword.Text = ""; txt_ConfirmPassword.Text = ""; txt_NewPassword.Text = ""; } else { lbl_Msg.Text = "Somthing Wrong! Pasword Can't be Changed."; } }
private void GenerateResult() { int Right = 0, Wrong = 0, NotAttampt = 0, i, n; float RightMarks = 0, WrongMarks = 0, TotalMarks = 0, ObtainedMarks = 0, per = 0; string sql, ResultId; float NegativeMarks = Convert.ToSingle(lbl_NegativeMarks.Text); int QuestionMarks = Convert.ToInt32(lbl_MarksPerQuestion.Text); DataTable dt = Session["AllQuestion"] as DataTable; n = dt.Rows.Count; for (i = 0; i < n; i++) { if (dt.Rows[i]["SelectedAnswer"].ToString() == "0") { NotAttampt++; } else if (dt.Rows[i]["SelectedAnswer"].ToString() != dt.Rows[i]["Answer"].ToString()) { Wrong++; dt.Rows[i]["Result"] = "0"; } else if (dt.Rows[i]["SelectedAnswer"].ToString() == dt.Rows[i]["Answer"].ToString()) { Right++; dt.Rows[i]["Result"] = "1"; } } // 1 Marks for Each Question TotalMarks = n * QuestionMarks; RightMarks = Right * QuestionMarks; WrongMarks = (float)Wrong * NegativeMarks; ObtainedMarks = RightMarks - WrongMarks; per = (ObtainedMarks / TotalMarks) * 100; //sql = " DELETE FROM tbl_Result WHERE EmailId='" + Session["EmailId"].ToString() + "'"; //sql = sql + " AND PaperId=" + Session["PaperId"].ToString(); //c1.ExecuteQry(sql); sql = " INSERT INTO tbl_Result(EmailId, ExamDate, Correct, Wrong, NotAttempt,Marks, per) VALUES "; sql = sql + " ('" + Session["EmailId"].ToString() + "',"; sql = sql + " '" + DateTime.Now.ToShortDateString() + "',"; sql = sql + " " + Right + "," + Wrong + "," + NotAttampt + "," + ObtainedMarks.ToString() + "," + per.ToString() + ")"; c1.ExecuteQry(sql); sql = "SELECT MAX(ResultId) FROM tbl_Result"; ResultId = c1.SelectScalar(sql); sql = " INSERT INTO tbl_ResultDetails(ResultId,QuestionId,Answer,Status) VALUES "; for (i = 0; i < n; i++) { sql = sql + "(" + ResultId + "," + dt.Rows[i]["QuestionId"].ToString() + ","; sql = sql + dt.Rows[i]["SelectedAnswer"].ToString() + "," + dt.Rows[i]["Result"].ToString() + "),"; } sql = sql.Substring(0, sql.Length - 1); c1.ExecuteQry(sql); Response.Redirect("MyAccount_Results.aspx"); }
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, Gender, ExpType; //, Resume_Url if (Opt_Male.Checked == true) { Gender = "Male"; } else { Gender = "Female"; } if (opt_Fresher.Checked == true) { ExpType = "Fresher"; } else { ExpType = "Experienced"; } sql = " UPDATE tbl_Member SET "; sql = sql + " Gender='" + Gender + "',"; sql = sql + " DOB='" + txt_DOB.Text + "',"; sql = sql + " Candidate_Address='" + txt_Address.Text + "',"; sql = sql + " State_Id='" + ddl_StatePersonal.SelectedValue.ToString() + "',"; sql = sql + " City_Id='" + ddl_CityPersonal.SelectedValue.ToString() + "',"; sql = sql + " Pin_Code='" + txt_PinCode.Text + "',"; sql = sql + " RegDate='" + DateTime.Now.ToShortDateString() + "',"; sql = sql + " Experience_Type='" + ExpType + "',"; sql = sql + " Desired_State='" + ddl_Desired_State.SelectedValue.ToString() + "',"; sql = sql + " Desired_City='" + ddl_Desired_City.SelectedValue.ToString() + "',"; sql = sql + " Sec_Board='" + ddl_Sec_Board.SelectedValue.ToString() + "',"; sql = sql + " Sec_Per='" + txt_Sec_Pecentage.Text + "',"; sql = sql + " Sec_Year='" + txt_Sec_Year.Text + "',"; sql = sql + " Sec_Type='" + ddl_Sec_Course_Type.SelectedValue.ToString() + "',"; sql = sql + " SrSec_Board='" + ddl_SrSec_Board.SelectedValue.ToString() + "',"; sql = sql + " SrSec_Subject='" + txt_SrSec_Subject.Text + "',"; sql = sql + " SrSec_Per='" + txt_SrSec_Pecentage.Text + "',"; sql = sql + " SrSec_Year='" + txt_SrSec_Year.Text + "',"; sql = sql + " SrSec_Type='" + ddl_SrSec_CourseType.SelectedValue.ToString() + "',"; if (ExpType == "Experienced") { sql = sql + " Experience_Year='" + ddl_Exp_Years.SelectedValue.ToString() + "',"; sql = sql + " Experience_Month='" + ddl_Exp_Months.SelectedValue.ToString() + "',"; sql = sql + " OldSallery='" + txt_Sallery.Text + "',"; sql = sql + " Reson='" + txt_reson.Text + "',"; sql = sql + " Key_Skills='" + txt_KeySkills.Text + "',"; sql = sql + " Job_Title='" + txt_Job_Title.Text + "',"; sql = sql + " Company_Name='" + txt_Cmpny_Name.Text + "',"; sql = sql + " Company_Industry='" + ddl_Industry.SelectedValue.ToString() + "',"; sql = sql + " Job_Functional_Area='" + ddl_FunctionalArea.SelectedValue.ToString() + "',"; sql = sql + " Job_Duration_Year='" + ddl_JobDur_Years.SelectedValue.ToString() + "',"; sql = sql + " Job_Duration_Month='" + ddl_JobDur_Months.SelectedValue.ToString() + "',"; sql = sql + " Current_Salary='" + txt_CSallery.Text + "',"; } sql = sql + " Graduation_Univ='" + ddl_Graduation_Uni.SelectedValue.ToString() + "',"; sql = sql + " Graduation_Degree='" + txt_Graduation_Degree.Text + "',"; sql = sql + " Graduation_Subject='" + txt_Graduation_Uni_Subject.Text + "',"; sql = sql + " Graduation_Per='" + txt_Graduation_Uni_Pecentage.Text + "',"; sql = sql + " Graduation_Year='" + txt_Graduation_Uni_Year.Text + "',"; sql = sql + " Graduation_Type='" + ddl_Graduation_Uni_Coursetype.SelectedValue.ToString() + "',"; sql = sql + " PG_Univ='" + ddl_PG_Uni.SelectedValue.ToString() + "',"; sql = sql + " PG_Degree='" + txt_PG_Degree.Text + "',"; sql = sql + " PG_Subject='" + txt_PG_Subject.Text + "',"; sql = sql + " PG_Per='" + txt_PG_Percentage.Text + "',"; sql = sql + " PG_Year='" + txt_PG_Year.Text + "',"; sql = sql + " PG_Type='" + ddl_PG_CourseType.SelectedValue.ToString() + "',"; sql = sql + " Other_Univ='" + ddl_Other_Uni.SelectedValue.ToString() + "',"; sql = sql + " Other_Degree='" + txt_Other_Degree.Text + "',"; sql = sql + " Other_Subject='" + txt_PG_Subject.Text + "',"; sql = sql + " Other_Per='" + txt_PG_Percentage.Text + "',"; sql = sql + " Other_Year='" + txt_PG_Year.Text + "',"; sql = sql + " Other_Type='" + ddl_Other_Uni.SelectedValue.ToString() + "'"; sql = sql + " WHERE MemberId=" + Session["MemberId"].ToString(); UploadPhoto(); UploadResume(); c1.ExecuteQry(sql); lbl_Msg.Text = "Your Resume SuccessFully Updated"; }
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; } } }