protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { bool IsCom = false; int ret = 0; if (!string.IsNullOrEmpty(Request.Form["ctl00$MainContent$heUserID"])) { //try //{ int UserId = int.Parse(Request.Form["ctl00$MainContent$heUserID"]); //Profile Process string FirstName = Request.Form["ctl00$MainContent$firstName"]; string LastName = Request.Form["ctl00$MainContent$LastName"]; string bytGender = Request.Form["ctl00$MainContent$dropGender"]; string Nationality = Request.Form["ctl00$MainContent$dropNation"]; string DatBirth = Request.Form["ctl00$MainContent$day"]; string Phone = Request.Form["ctl00$MainContent$txtPhon"]; Model_Users us = new Model_Users { UserID = UserId, FirstName = FirstName, LastName = LastName, DateofBirth = DatBirth.DateSplitYear('-'), Gender = byte.Parse(bytGender), Nationality = int.Parse(Nationality), MobileNumber = Phone }; us.UpdateUserProfileFront(us); //Fuction Competencies string FCCheck = Request.Form["chckFC_form"]; if (!string.IsNullOrEmpty(FCCheck)) { string[] arrfc = FCCheck.Split(','); if (arrfc.Length > 0) { List <Model_UserFC> list = new List <Model_UserFC>(); foreach (string i in arrfc) { list.Add(new Model_UserFC { FCID = int.Parse(i), UserID = UserId }); } Model_UserFC fc = new Model_UserFC(); fc.AddUserFC(list, UserId); } } //Current Job string CJFCheck = Request.Form["chckCJF_form"]; if (!string.IsNullOrEmpty(CJFCheck)) { string[] arrcjf = CJFCheck.Split(','); if (arrcjf.Length > 0) { List <Model_UserCJF> list = new List <Model_UserCJF>(); foreach (string i in arrcjf) { list.Add(new Model_UserCJF { CJFID = int.Parse(i), UserID = UserId }); } Model_UserCJF cjf = new Model_UserCJF(); cjf.AddUserCjf(list, UserId); } } //UserAssessment Transaction Model_UsersTransaction ts = new Model_UsersTransaction { UserID = UserId }; int tsid = ts.InsertUserTsAss(ts); if (tsid > 0) { //Score Process string ass = Request.Form["ass_fill_"]; if (!string.IsNullOrEmpty(Request.Form["ass_fill_"])) { string[] arrAss = ass.Split(','); if (arrAss.Length > 0) { //List<Model_UsersAssessment> uslist = new List<Model_UsersAssessment>(); foreach (string assItem in arrAss) { string assSCore = Request.Form["ass_fill_i_sc_" + assItem]; //if (!string.IsNullOrEmpty(assSCore)) // { int AssID = int.Parse(assItem); int AssScore = 0; if (!string.IsNullOrEmpty(assSCore)) { AssScore = int.Parse(assSCore); } Model_UsersAssessment uass = new Model_UsersAssessment { ASID = AssID, TransactionID = tsid, Score = AssScore }; int intTASID = uass.InsertUserAssessment(uass); string asssChoice = Request.Form["ass_fill_ch_" + assItem]; if (!string.IsNullOrEmpty(asssChoice)) { string[] arrChoice = asssChoice.Split(','); if (arrChoice.Length > 0) { foreach (string choiceItem in arrChoice) { string assChoiceScore = Request.Form["ass_fill_ch_sc_" + assItem + "_" + choiceItem]; if (!string.IsNullOrEmpty(assChoiceScore)) { int AssChoiceID = int.Parse(choiceItem); int AssChoiceScore = int.Parse(assChoiceScore); Model_UsersAssChoice usch = new Model_UsersAssChoice { ASID = AssID, TransactionID = tsid, ASCID = AssChoiceID, TASID = intTASID, Score = AssChoiceScore }; usch.InsertUserAssessmentChoice(usch); //insert choice here } } } } // } } } } } // assessment is recorded! IsCom = true; if (IsCom) { ret = CalculationController.CalculateActionStart(tsid); } //} //catch(Exception ex) //{ // string ee = ex.Message + ex.StackTrace; // IsCom = false; //} } string strRet = "True"; switch (ret) { case -1: strRet = "False"; break; case 0: strRet = "True"; break; default: strRet = ret.ToString(); break; } Response.Write(strRet); Response.End(); } }
protected void btnDownload_Click(object sender, EventArgs e) { int UserId = int.Parse(Request.Form["ctl00$MainContent$heUserID"]); string FirstName = Request.Form["ctl00$MainContent$firstName"]; string LastName = Request.Form["ctl00$MainContent$LastName"]; string bytGender = Request.Form["ctl00$MainContent$dropGender"]; string Nationality = Request.Form["ctl00$MainContent$dropNation"]; string DatBirth = Request.Form["ctl00$MainContent$day"]; string Phone = Request.Form["ctl00$MainContent$txtPhon"]; Model_Users us = new Model_Users { Email = txtEmail.Text.Trim(), UserID = UserId, FirstName = FirstName, LastName = LastName, DateofBirth = DatBirth.DateSplitYear('-'), Gender = byte.Parse(bytGender), Nationality = int.Parse(Nationality), MobileNumber = Phone }; int ret = us.UpdateUserProfileUserEdit(us); if (ret > 0) { string FCCheck = Request.Form["chckFC_form"]; if (!string.IsNullOrEmpty(FCCheck)) { string[] arrfc = FCCheck.Split(','); if (arrfc.Length > 0) { List <Model_UserFC> list = new List <Model_UserFC>(); foreach (string i in arrfc) { list.Add(new Model_UserFC { FCID = int.Parse(i), UserID = UserId }); } Model_UserFC fc = new Model_UserFC(); fc.AddUserFC(list, UserId); } } //Current Job string CJFCheck = Request.Form["chckCJF_form"]; if (!string.IsNullOrEmpty(CJFCheck)) { string[] arrcjf = CJFCheck.Split(','); if (arrcjf.Length > 0) { List <Model_UserCJF> list = new List <Model_UserCJF>(); foreach (string i in arrcjf) { list.Add(new Model_UserCJF { CJFID = int.Parse(i), UserID = UserId }); } Model_UserCJF cjf = new Model_UserCJF(); cjf.AddUserCjf(list, UserId); } } Response.Redirect("/"); } else { lblError.Text = "The User Name is user already"; } //Fuction Competencies }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "KeenProfile Assessment"; if (!this.Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["success"])) { main_thanks.Visible = true; main_form.Visible = false; Model_AssesIntro intro = new Model_AssesIntro(); intro = intro.GetIntro(); ThanksTitle.Text = intro.ThanksTitle; ThanksDes.Text = convertcontent(intro.ThanksDes); } else { Model_Users u = this.UserActive; if (u != null) { //Get Main Intro Model_AssesIntro intro = new Model_AssesIntro(); intro = intro.GetIntro(); //Get Job Function Model_CJF cjf = new Model_CJF(); List <Model_CJF> cjflist = cjf.GetCJFeAll(); Model_UserCJF cjflistUser = new Model_UserCJF(); List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID); //Get Functional Competencies Model_FC fc = new Model_FC(); List <Model_FC> fclist = fc.GetFCAll(); Model_UserFC fcuser = new Model_UserFC(); List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID); //Get Section Model_AsSection section = new Model_AsSection(); List <Model_AsSection> sectionlist = section.GetListSection(true); //Get Assessment Model_Assessment ass = new Model_Assessment(); List <Model_Assessment> asslist = ass.GetAssessmentAll(); //Get Country Model_Country c = new Model_Country(); List <Model_Country> ccountry = c.GetAllCountry(); dropNation.DataSource = ccountry; dropNation.DataTextField = "DropValue"; dropNation.DataValueField = "ID"; dropNation.DataBind(); dropNation.SelectedValue = "211"; StringBuilder strcjf = new StringBuilder(); StringBuilder strfc = new StringBuilder(); strcjf.Append("<div class=\"checkitem\">"); foreach (Model_CJF i in cjflist.Where(r => r.Status)) { string check = string.Empty; if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0) { check = "Checked=\"Checked\""; } strcjf.Append("<div class=\"item\">"); strcjf.Append("<input type=\"radio\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">"); strcjf.Append("<label>" + i.Title + "</label>"); strcjf.Append("</div>"); } strcjf.Append("</div>"); strfc.Append("<div class=\"checkitem\">"); foreach (Model_FC i in fclist) { string check = string.Empty; if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0) { check = "Checked=\"Checked\""; } strfc.Append("<div class=\"item\">"); strfc.Append("<input type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">"); strfc.Append("<label>" + i.Title + "</label>"); strfc.Append("</div>"); } strfc.Append("</div>"); chckCJF.Text = strcjf.ToString(); // checkFC.Text = strfc.ToString(); IntroTitle.Text = intro.Title; IntroDetail.Text = convertcontent(intro.Description); LastTitle.Text = intro.LastTitle; LastDes.Text = convertcontent(intro.LastDes); Maintitle.Text = intro.MainTitle; profiletitle.Text = intro.ProfileTitle; //fctitle.Text = intro.ProfileFCTitle; cjftitle.Text = intro.ProfileCJFTitle; StringBuilder ret = new StringBuilder(); foreach (Model_AsSection sec in sectionlist) { //string sIntro = sec.Title; //string sDetail = convertcontent(sec.Intro); List <Model_Assessment> list = asslist.Where(r => r.SCID == sec.SCID).OrderBy(r => r.Priority).ThenBy(r => r.GroupName).ToList(); if (list.Count > 0) { ret.Append(GenSectionIntro(sec)); foreach (Model_Assessment asi in list) { string question = asi.Questions; int rs = asi.StartRank; int rd = asi.EndRank; byte questionType = asi.QTID; // 1 Scale //4 Ranking Scale //5 Left / Right Ranking switch (questionType) { //Scale case 1: ret.Append(GenQuestionTypeScale(asi)); break; //Ranking Scale case 4: ret.Append(GenQuestionTypeRankingScalChoice(asi)); break; //Left / Right Ranking case 5: ret.Append(GenQuestionTypeRankLeftRigth(asi)); break; } } } } Stepcontent.Text = ret.ToString(); //Binding profile (initial data) heUserID.Value = u.UserID.ToString(); firstName.Text = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName); LastName.Text = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName); dropGender.SelectedValue = u.Gender.ToString(); dropNation.SelectedValue = u.Nationality.ToString(); day.Text = (u.DateofBirth != null? u.DateofBirth.ToString("yyy-MM-dd"): ""); txtPhon.Text = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber); } } } else { //Button btn = (Button)sender; //Response.Write(chckCJF.SelectedValue); } }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "KeenProfile Your Profile"; if (!this.Page.IsPostBack) { //if (!string.IsNullOrEmpty(Request.QueryString["success"])) //{ // main_thanks.Visible = true; // main_form.Visible = false; // Model_AssesIntro intro = new Model_AssesIntro(); // intro = intro.GetIntro(); // ThanksTitle.Text = intro.ThanksTitle; // ThanksDes.Text = convertcontent(intro.ThanksDes); //} Model_Users u = this.UserActive; if (u != null) { //Get Job Function Model_CJF cjf = new Model_CJF(); List <Model_CJF> cjflist = cjf.GetCJFeAll(); Model_UserCJF cjflistUser = new Model_UserCJF(); List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID); //Get Functional Competencies Model_FC fc = new Model_FC(); List <Model_FC> fclist = fc.GetFCAll(); Model_UserFC fcuser = new Model_UserFC(); List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID); //Get Country Model_Country c = new Model_Country(); List <Model_Country> ccountry = c.GetAllCountry(); dropNation.DataSource = ccountry; dropNation.DataTextField = "DropValue"; dropNation.DataValueField = "ID"; dropNation.DataBind(); dropNation.SelectedValue = "211"; StringBuilder strcjf = new StringBuilder(); StringBuilder strfc = new StringBuilder(); strcjf.Append("<div class=\"checkitem\">"); foreach (Model_CJF i in cjflist.Where(o => o.Status)) { string check = string.Empty; if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0) { check = "Checked=\"Checked\""; } strcjf.Append("<div class=\"item\">"); strcjf.Append("<input type=\"radio\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">"); strcjf.Append("<label>" + i.Title + "</label>"); strcjf.Append("</div>"); } strcjf.Append("</div>"); //strfc.Append("<div class=\"checkitem\">"); //foreach (Model_FC i in fclist) //{ // string check = string.Empty; // if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0) // check = "Checked=\"Checked\""; // strfc.Append("<div class=\"item\">"); // strfc.Append("<input type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">"); // strfc.Append("<label>" + i.Title + "</label>"); // strfc.Append("</div>"); //} //strfc.Append("</div>"); chckCJF.Text = strcjf.ToString(); //checkFC.Text = strfc.ToString(); Maintitle.Text = "Your Profile"; //Binding profile (initial data) heUserID.Value = u.UserID.ToString(); firstName.Text = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName); LastName.Text = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName); dropGender.SelectedValue = u.Gender.ToString(); dropNation.SelectedValue = u.Nationality.ToString(); day.Text = (u.DateofBirth != null ? u.DateofBirth.ToString("yyy-MM-dd") : ""); txtPhon.Text = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber); txtEmail.Text = u.Email; } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { //dropRole.DataSource = UsersController.GetUserRole(); //dropRole.DataTextField = "Title"; //dropRole.DataValueField = "UsersRoleId"; //dropRole.DataBind(); //ListItem lis = new ListItem("All", "0"); //dropRole.Items.Insert(0, lis); if (!string.IsNullOrEmpty(Request.QueryString["s"])) { int USerID = int.Parse(Request.QueryString["s"]); Model_Users u = new Model_Users(); u = u.getUserbyID(USerID); //Get Job Function Model_CJF cjf = new Model_CJF(); List <Model_CJF> cjflist = cjf.GetCJFeAll(); Model_UserCJF cjflistUser = new Model_UserCJF(); List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID); //Get Functional Competencies Model_FC fc = new Model_FC(); List <Model_FC> fclist = fc.GetFCAll(); Model_UserFC fcuser = new Model_UserFC(); List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID); //Get Country Model_Country c = new Model_Country(); List <Model_Country> ccountry = c.GetAllCountry(); dropNation.DataSource = ccountry; dropNation.DataTextField = "DropValue"; dropNation.DataValueField = "ID"; dropNation.DataBind(); dropNation.SelectedValue = "211"; StringBuilder strcjf = new StringBuilder(); StringBuilder strfc = new StringBuilder(); strcjf.Append("<div class=\"checkitem\">"); foreach (Model_CJF i in cjflist) { string check = string.Empty; if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0) { check = "Checked=\"Checked\""; } strcjf.Append("<div class=\"item\">"); strcjf.Append("<input type=\"checkbox\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">"); strcjf.Append("<label>" + i.Title + "</label>"); strcjf.Append("</div>"); } strcjf.Append("</div>"); strfc.Append("<div class=\"checkitem\">"); foreach (Model_FC i in fclist) { string check = string.Empty; if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0) { check = "Checked=\"Checked\""; } strfc.Append("<div class=\"item\">"); strfc.Append("<input type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">"); strfc.Append("<label>" + i.Title + "</label>"); strfc.Append("</div>"); } strfc.Append("</div>"); chckCJF.Text = strcjf.ToString(); checkFC.Text = strfc.ToString(); //Maintitle.Text = "Your Profile"; //Binding profile (initial data) firstName.Text = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName); LastName.Text = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName); dropGender.SelectedValue = u.Gender.ToString(); dropNation.SelectedValue = u.Nationality.ToString(); day.Text = (u.DateofBirth != null ? u.DateofBirth.ToString("yyy-MM-dd") : ""); txtPhon.Text = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber); txtEmail.Text = u.Email; } } }