public static void GetTsByUserID(Model_UsersTransaction parameters) { IList <Model_UsersTransaction> ret = UsersController.getUserTransactionByUserID(parameters); AppTools.SendResponse(HttpContext.Current.Response, ret.ObjectToJSON()); }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "KeenProfile Member"; if (!this.Page.IsPostBack) { Model_Users u = this.UserActive; if (u != null) { name.Text = (String.IsNullOrEmpty(u.FirstName)?"XXXX": u.FirstName) + " " + (String.IsNullOrEmpty(u.LastName) ? "XXXX" : u.LastName); //cjf.Text = (u.UserCJF.Count > 0 ? u.UserCJF[0].Title : "XXX"); //nation.InnerHtml = u.NationalityTitle; dob.Text = (u.DateofBirth != null? u.DateofBirth.ToString("dd MMM yyyy") + " (" + (DatetimeHelper._UTCNow().Year - u.DateofBirth.Year).ToString() + ")": "XXXX"); gender.Text = (u.Gender == 1 ? "Male" : "Female"); // fc.Text = string.Join(", ", u.UserFC.Select(r => r.Title).ToArray()); if (!u.EmailVerify) { Do_assessment.Attributes.Add("disabled", "disabled"); Do_assessment.Attributes.Add("onclick", "ShowAlert(event);"); //btnReport1.Attributes.Add("disabled", "disabled"); //btnReport2.Attributes.Add("disabled", "disabled"); //btnReport3.Attributes.Add("disabled", "disabled"); //btnReport4.Attributes.Add("disabled", "disabled"); btnReport1.Attributes.Add("onclick", "ShowAlert(event);"); btnReport2.Attributes.Add("onclick", "ShowAlert(event);"); btnReport3.Attributes.Add("onclick", "ShowAlert(event);"); btnReport4.Attributes.Add("onclick", "ShowAlert(event);"); } //btnReport1 //btnReport3 //btnReport2 int intProductID = 1; int intProductCoach = 2; Model_Orders o = new Model_Orders(); int paid = o.CountIsPaidByProduct(intProductID, u.UserID); int paidCoaching = o.CountIsPaidByProduct(intProductCoach, u.UserID); Model_UsersTransaction Uts = new Model_UsersTransaction(); List <Model_UsersTransaction> TSL = Uts.getTsListByUserID(u.UserID); sample_r1.NavigateUrl = "http://www.keenprofile.com/wp-content/uploads/2018/01/Example-KEENCareer-Finder-Report.pdf"; sample_r2.NavigateUrl = "http://www.keenprofile.com/wp-content/uploads/2018/01/Example-Your-Current-Job-Company-Fit-Report.pdf"; sample_r3.NavigateUrl = "http://www.keenprofile.com/wp-content/uploads/2018/01/Example-The-Right-Job-Functions-Report.pdf"; if (TSL.Count > 0) { btnReport1.Text = "คลิกเพื่อ Download"; btnReport2.Text = "คลิกเพื่อ Download"; btnReport3.Text = paid > 0? "คลิกเพื่อ Download" : "ต้องการ Download"; btnReport4.Text = paidCoaching > 0? "รอการ Coaching" : "ต้องการ Coaching"; if (paidCoaching > 0) { fa_r4_1.Visible = false; fa_r4_2.Visible = true; btnReport4.CssClass = "btn_button btn_coach"; } if (paid > 0) { fa_r3_1.Visible = true; fa_r3_2.Visible = false; btnReport3.CssClass = "btn_button btn_r3"; sample_r3.Visible = false; } sample_r1.Visible = false; sample_r2.Visible = false; } else { btnReport1.Text = "คลิกเพื่อ Download"; btnReport2.Text = "คลิกเพื่อ Download"; btnReport3.Text = "ต้องการ Download"; btnReport4.Text = "ต้องการ Coaching"; btnReport1.CommandArgument = "0"; btnReport2.CommandArgument = "0"; btnReport3.CommandArgument = "0"; btnReport4.CommandArgument = "0"; } } } }
public static IList <Model_UsersTransaction> getUserTransactionByUserID(Model_UsersTransaction ts) { return(ts.getTsListByUserID(ts.UserID)); }
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(); } }
//User TRSANSACTION public static IList <Model_UsersTransaction> getUserTransaction(Model_UsersTransaction ts) { return(ts.getTsListl_Paging(ts)); }