protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { Model_JobFunctionGroup cGroup = new Model_JobFunctionGroup(); dropGroup.DataSource = cGroup.GetAll(); dropGroup.DataTextField = "Title"; dropGroup.DataValueField = "JGID"; dropGroup.DataBind(); if (!string.IsNullOrEmpty(Request.QueryString["g"])) { add_section.Visible = true; int id = int.Parse(Request.QueryString["g"]); Model_Jobfunction cf = new Model_Jobfunction(); cf = cf.GetByID(id); JobID.Text = cf.JFID.ToString(); rname.Text = cf.Title; status.SelectedValue = cf.Status.ToString(); dropGroup.SelectedValue = cf.JGID.ToString(); txtintro.Text = cf.DesInto; txtdes1.Text = cf.Des1; txtdes2.Text = cf.Des2; txtdes3.Text = cf.Des3; txtdes4.Text = cf.Des4; txtdes5.Text = cf.Des5; headsection_pan.InnerHtml = "Edit"; } } }
public static void JobFucntion(Model_Jobfunction parameters) { Model_Jobfunction cgroup = new Model_Jobfunction(); List <Model_Jobfunction> ret = cgroup.GetAll(); AppTools.SendResponse(HttpContext.Current.Response, ret.ObjectToJSON()); }
protected void Button1_Click(object sender, EventArgs e) { string s = rname.Text.Trim(); string title = rname.Text; int intGroup = int.Parse(dropGroup.SelectedValue); bool st = bool.Parse(status.SelectedValue); string strDes1 = txtdes1.Text; string strDes2 = txtdes2.Text; string strDes3 = txtdes3.Text; string strDes4 = txtdes4.Text; string strDes5 = txtdes5.Text; string Destxtintro = txtintro.Text; int intJobID = int.Parse(JobID.Text); Button btn = (Button)sender; Model_Jobfunction cgroup = new Model_Jobfunction { DesInto = Destxtintro, Des1 = strDes1, Des2 = strDes2, Des3 = strDes3, Des4 = strDes4, Des5 = strDes5, Status = st, Title = s, JGID = intGroup, JFID = intJobID }; if (!string.IsNullOrEmpty(Request.QueryString["g"])) { cgroup.JFID = int.Parse(Request.QueryString["g"]); if (cgroup.UpdateById(cgroup)) { Response.Redirect("JobFunctionContent2"); } } else { if (cgroup.Insert(cgroup) > 0) { Response.Redirect(Request.Url.ToString()); } } }
//public bool IsDup { get; set; } public Calculation_T6(int intResultSectionID, int TransactionID) { this.ResultSectionID = intResultSectionID; this.TransactionID = TransactionID; Model_ReportSectionItem rss = new Model_ReportSectionItem(); this.ReportSectionItem = rss.GetListItemBySectionID(this.ResultSectionID); Model_ReportItemResult ret = new Model_ReportItemResult(); this.ReportResultT4 = ret.GetItemReportByTransactionID(this.TransactionID, 4); this.ReportResultT2 = ret.GetItemReportByTransactionID(this.TransactionID, 2); Model_Jobfunction cj = new Model_Jobfunction(); this.JobFunctionList = cj.GetAll(); Model_JobFunctionListMain cjm = new Model_JobFunctionListMain(); this.JobFunctionListMain = cjm.GetAllActive(); Model_JobFunctionListMap cjmap = new Model_JobFunctionListMap(); this.JobFunctionListMap = cjmap.GetAllList(); Model_JFR1 r1 = new Model_JFR1(); this.Rule1 = r1.GetAll(); Model_JFR2 r2 = new Model_JFR2(); this.Rule2 = r2.GetAll(); Model_JFR3 r3 = new Model_JFR3(); this.Rule3 = r3.GetAll(); Model_JFR4 r4 = new Model_JFR4(); this.Rule4 = r4.GetAll(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { Model_Jobfunction j = new Model_Jobfunction(); droupJob.DataSource = j.GetAll(); droupJob.DataTextField = "Title"; droupJob.DataValueField = "JFID"; droupJob.DataBind(); JobFunctionListdrop.DataSource = j.GetAll(); JobFunctionListdrop.DataTextField = "Title"; JobFunctionListdrop.DataValueField = "JFID"; JobFunctionListdrop.DataBind(); Model_JobFunctionListMain main = new Model_JobFunctionListMain(); dropScoreMain.DataSource = main.GetAllActive(); dropScoreMain.DataTextField = "Title"; dropScoreMain.DataValueField = "JFMID"; dropScoreMain.DataBind(); if (!string.IsNullOrEmpty(Request.QueryString["g"]) && !string.IsNullOrEmpty(Request.QueryString["m"])) { add_section.Visible = true; int JFID = int.Parse(Request.QueryString["g"]); int JFMID = int.Parse(Request.QueryString["m"]); Model_JobFunctionListMap cgroup = new Model_JobFunctionListMap(); cgroup = cgroup.GetByID(JFID, JFMID); Score.Text = cgroup.Score.ToString(); JobFunctionListdrop.SelectedValue = JFID.ToString(); dropScoreMain.SelectedValue = cgroup.JFMID.ToString(); headsection_pan.InnerHtml = "Edit"; } } }
//Get Subsection F and H public List <Model_ReportItemResult> Code_SumValueBySubSection() { //Cdoe F = Section 7; List <Model_ReportItemResult> rlist = new List <Model_ReportItemResult>(); var T2Ranking = this.ReportResultT2.Select(s => new { ResultID = s.ResultID, ResultItemID = s.ResultItemID, Ranking = this.ReportResultT2.Count(x => (decimal)x.Score_new > (decimal)s.Score_new) + 1, Name = s.ResultItemTitle, Score = s.Score_new }); foreach (Model_ReportSectionItem item in this.ReportSectionItem) { string map = item.SUCID; //string[] arrGroup = map.Split('#'); string[] arrmap = map.Split(','); decimal score = 0; decimal score_y = 0; decimal score_c = 0; string group = string.Empty; byte Side_y = 0; byte Side_c = 0; byte frequency_c = 0; byte frequency_y = 0; decimal SumGeniuses = 0.0m; decimal SumTrait = 0.0m; decimal ReqSupGeniuses = 0.0m; decimal ReqSupBottom = 0.0m; int CountSup = this.ReportResultT4.Where(o => o.GT == 1).Count(); int CountBottom = this.ReportResultT4.Where(o => o.GT == 5).Count(); if (arrmap.Length > 0) { foreach (string m in arrmap) { List <Model_Jobfunction> cj = this.JobFunctionList.Where(o => o.JFID == int.Parse(m)).ToList(); if (cj.Count > 0) { Model_Jobfunction cJob = cj.FirstOrDefault(); foreach (Model_JobFunctionListMain main in this.JobFunctionListMain.Where(o => o.Category == 1)) { Model_ReportItemResult ass = this.ReportResultT4.Where(o => o.ResultItemID == int.Parse(main.Mapping)).FirstOrDefault(); Model_JobFunctionListMap mapscore = this.JobFunctionListMap.Where(o => o.JFID == cJob.JFID && o.JFMID == main.JFMID).FirstOrDefault(); if (mapscore != null && ass != null) { Model_JFR1 rule1ret = this.Rule1.Where(o => o.Score == (int)ass.GT).FirstOrDefault(); SumGeniuses += (decimal)rule1ret.GetType().GetProperty("CJRRuleScore" + mapscore.Score).GetValue(rule1ret); foreach (Model_JFR3 r3 in this.Rule3.Where(o => o.Cat == 1)) { if (CalKey(r3.Condition1, (int)ass.GT) && CalKey(r3.Condition2, (int)mapscore.Score)) { ReqSupGeniuses += r3.Score; //if (r3.Score == 1) // CountSup = CountSup + 1; break; } } foreach (Model_JFR3 r3 in this.Rule3.Where(o => o.Cat == 2)) { if (CalKey(r3.Condition1, (int)ass.GT) && CalKey(r3.Condition2, (int)mapscore.Score)) { ReqSupBottom += r3.Score; //if (r3.Score == 5) // CountBottom = CountBottom + 1; break; } } //Model_JFR3 rule2ret = this.Rule3.Where(o => ).FirstOrDefault(); //ReqSupGeniuses += (decimal)rule2ret.GetType().GetProperty("CJRRuleScore" + mapscore.Score).GetValue(rule1ret); //Model_JFR3 rule3ret = this.Rule3.Where(o => o.Score == (int)ass.GT && o.Cat == 2).FirstOrDefault(); } } foreach (Model_JobFunctionListMain main in this.JobFunctionListMain.Where(o => o.Category == 2)) { var ass = T2Ranking.Where(o => o.ResultItemID == int.Parse(main.Mapping)).FirstOrDefault(); Model_JobFunctionListMap mapscore = this.JobFunctionListMap.Where(o => o.JFID == cJob.JFID && o.JFMID == main.JFMID).FirstOrDefault(); if (mapscore != null && ass != null) { Model_JFR2 rule1ret = this.Rule2.Where(o => o.Score == (int)ass.Ranking).FirstOrDefault(); SumTrait += (decimal)rule1ret.GetType().GetProperty("CJRRuleScore" + mapscore.Score).GetValue(rule1ret); } } } } rlist.Add(new Model_ReportItemResult { ResultSectionID = this.ResultSectionID, ResultItemID = item.ResultItemID, ResultItemTitle = item.Title, TransactionID = this.TransactionID, Score = score, Score_new = score, Score_y = score_y, Score_c = score_c, T5Group = group, Side_c = Side_c, Side_y = Side_y, Frequency_c = frequency_c, Frequency_y = frequency_y, SumGeniuses = SumGeniuses, SumTrait = SumTrait, ReqSupBottom = ReqSupBottom, ReqSupGeniuses = ReqSupGeniuses, CountBottom = CountBottom, CountSup = CountSup }); } } List <Model_ReportItemResult> ListReview = ReviewResult(rlist); return(ListReview.OrderByDescending(o => o.Score_new).ToList()); }
protected void btnImport_Click(object sender, EventArgs e) { string strFileName = string.Empty; string strPath = string.Empty; Base64BinarySrtingToFile save = new Base64BinarySrtingToFile { FilePrefix = "1" }; save.SaveFileNew(HttpContext.Current.Request.Files["ctl00$MainContent$fileImport"]); if (save.IsSaved) { strFileName = save.FileName; strPath = save.Path; DataTable data = null; data = new GsCsvReader(strPath, strFileName, 1, 26).ResultDataTable; if (data.Rows.Count > 0) { Model_Jobfunction cde = new Model_Jobfunction(); //cde.DeleteAll(); int count = 0; Model_JobFunctionListMain cm = new Model_JobFunctionListMain(); Model_ReportSectionItem cc = new Model_ReportSectionItem(); cc.Delete(6); foreach (DataRow row in data.Rows) { if (count > 0) { Model_Jobfunction cSub = new Model_Jobfunction { JFID = int.Parse(row[2].ToString()), JGID = int.Parse(row[0].ToString()), Title = row[3].ToString() //Email = (row.Table.Columns.Contains("Email") ? (row["Email"] == DBNull.Value ? "" : (string)row["Email"]) : ""), //FirstName = (row.Table.Columns.Contains("FirstName") ? (row["FirstName"] == DBNull.Value ? "" : (string)row["FirstName"]) : ""), //LastName = (row.Table.Columns.Contains("LastName") ? (row["LastName"] == DBNull.Value ? "" : (string)row["LastName"]) : ""), //Sbin = true, //SGID = int.Parse(p.Group) }; cSub.insert(cSub); int intJobfcuntionID = int.Parse(row[2].ToString()); Model_ReportSectionItem sub = new Model_ReportSectionItem { ResultSectionID = 6, Title = row[3].ToString(), Status = true, Priority = count, Code = "T6" + count, SUCID = row[2].ToString(), Short = "", Detail = "", PeopleTxt = "", CultureTxt = "", CompetitionTxt = "", }; sub.Insert(sub); List <Model_JobFunctionListMain> cm1 = cm.GetAllActive(); int count1 = 4; foreach (Model_JobFunctionListMain i1 in cm1.Where(o => o.Category == 1).OrderBy(o => o.Priority)) { Model_JobFunctionListMap cj = new Model_JobFunctionListMap { JFID = intJobfcuntionID, JFMID = i1.JFMID, Score = int.Parse(row[count1].ToString()), }; cj.insert(cj); count1 = count1 + 1; } int count2 = 22; foreach (Model_JobFunctionListMain i2 in cm1.Where(o => o.Category == 2).OrderBy(o => o.Priority)) { Model_JobFunctionListMap cj = new Model_JobFunctionListMap { JFID = intJobfcuntionID, JFMID = i2.JFMID, Score = int.Parse(row[count2].ToString()), }; cj.insert(cj); count2 = count2 + 1; } } count = count + 1; } } } Response.Redirect(Request.Url.ToString()); }