private void getData() { DataView dv; BTC btc = new BTC(); Connection Conn = new Connection(); string strSql = " Select ActivityCode, ActivityName, StudyYear, RealSDate As SDate, RealEDate As EDate, '' EmpName, '' DeptName " + " From Activity Where DelFlag = 0 And StudyYear = '" + ddlYearB.SelectedValue + "' " + " And SchoolID = '" + CurrentUser.SchoolID + "'"; if (ddlMonth.SelectedValue != "00") { strSql += " And '" + Convert.ToInt32(ddlMonth.SelectedValue) + "' Between Month(RealSDate) And Month(RealEDate) "; } if (!string.IsNullOrEmpty(ddlSearchDept.SelectedValue)) { strSql = " Select a.ActivityCode, a.ActivityName, a.StudyYear, a.RealSDate As SDate, a.RealEDate As EDate, '' EmpName, '' DeptName " + " From Activity a, dtAcDept c " + " Where a.DelFlag = 0 And a.ActivityCode = c.ActivityCode " + " And a.StudyYear = '" + ddlYearB.SelectedValue + "' And a.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; if (ddlMonth.SelectedValue != "00") { strSql += " And '" + Convert.ToInt32(ddlMonth.SelectedValue) + "' Between Month(a.RealSDate) And Month(a.RealEDate) "; } } if (!string.IsNullOrEmpty(ddlSearchEmp.SelectedValue)) { if (string.IsNullOrEmpty(ddlSearchDept.SelectedValue)) { strSql = " Select a.ActivityCode, a.ActivityName, a.StudyYear, a.RealSDate As SDate, a.RealEDate As EDate, '' EmpName, '' DeptName " + " From Activity a, dtAcEmp c " + " Where a.DelFlag = 0 And a.ActivityCode = c.ActivityCode " + " And a.StudyYear = '" + ddlYearB.SelectedValue + "' And a.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; if (ddlMonth.SelectedValue != "00") { strSql += " And '" + Convert.ToInt32(ddlMonth.SelectedValue) + "' Between Month(a.RealSDate) And Month(a.RealEDate) "; } } else { strSql = " Select a.ActivityCode, a.ActivityName, a.StudyYear, a.RealSDate As SDate, a.RealEDate As EDate, '' EmpName, '' DeptName " + " From Activity a, dtAcEmp c, dtAcDept d " + " Where a.DelFlag = 0 And a.ActivityCode = c.ActivityCode And a.ActivityCode = d.ActivityCode " + " And a.StudyYear = '" + ddlYearB.SelectedValue + "' And a.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' And d.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; if (ddlMonth.SelectedValue != "00") { strSql += " And '" + Convert.ToInt32(ddlMonth.SelectedValue) + "' Between Month(a.RealSDate) And Month(a.RealEDate) "; } } } dv = Conn.Select(string.Format(strSql + " Order By RealSDate")); if (dv.Count > 0) { for (int i = 0; i < dv.Count; i++) { dv[i]["EmpName"] = btc.getAcEmpName(dv[i]["ActivityCode"].ToString()); dv[i]["DeptName"] = btc.getAcDeptName(dv[i]["ActivityCode"].ToString()); } } DataView dvSchool = btc.getMasterSchool(); string schoolName = ""; if (dvSchool.Count > 0) { schoolName = dvSchool[0]["SchoolName"].ToString(); } else { FormsAuthentication.RedirectToLoginPage(); } GridView1.DataSource = dv; GridView1.DataBind(); }
static void Main() { List <BTC> btc = new List <BTC>(); BTC.BTC_full_info[] btc_full = new BTC.BTC_full_info[2]; Console.WriteLine("Start"); byte counter = 0; HtmlWeb webDoc = new HtmlWeb(); HtmlDocument html = webDoc.Load("https://btc.com/stats/diff"); HtmlNodeCollection nodes = html.DocumentNode.SelectNodes("//td"); if (nodes != null) { BTC.BTC_full_info btc_full_obj = new BTC.BTC_full_info(); foreach (var tag in nodes) { if (counter == 7 || counter == 14) { if (counter == 14) { btc_full[1] = new BTC.BTC_full_info().copyARGS(btc_full_obj); break; } else { btc_full[0] = new BTC.BTC_full_info().copyARGS(btc_full_obj); } } switch (counter) { case 0: case 7: btc_full_obj.height = double.Parse(tag.InnerText.Replace(" ", "").Replace("\n", "")); break; case 2: case 9: btc_full_obj.lvl = tag.InnerText; break; case 5: case 12: btc_full_obj.time_diging = tag.InnerText; break; case 6: case 13: btc_full_obj.power = tag.InnerText; break; } counter++; //Console.WriteLine(tag.InnerText); } } DateTime date = DateTime.Now; for (byte i = 0; i < 3; i++) { webDoc = new HtmlWeb(); html = webDoc.Load("https://btc.com/block?date=" + date.Year + "-" + (date.Month < 10 ? "0" + date.Month : date.Month + "") + "-" + date.Day); nodes = html.DocumentNode.SelectNodes("//td"); double lvl_of_hardness = btc_full[0].height; if (nodes != null) { counter = 0; BTC btc_obj = new BTC(); foreach (var tag in nodes) { if (counter > 9) { counter = 0; if (btc_obj.height >= lvl_of_hardness) { btc_obj.Full_Info = btc_full[0]; } else { btc_obj.Full_Info = btc_full[1]; } btc.Add(new BTC().copyARGS(btc_obj)); } switch (counter) { case 0: btc_obj.height = double.Parse(tag.InnerText.Replace(" ", "").Replace("\n", "")); break; case 1: btc_obj.ovner = tag.InnerText; break; case 8: btc_obj.date = tag.InnerText.Replace(" ", "").Replace("\n", ""); break; } counter++; Console.WriteLine(tag.InnerText); } } date = date.AddDays(-1); } Console.WriteLine("end"); foreach (var tag in btc) { //не выводит полное инфо Console.WriteLine(tag.ovner + " " + tag.date + " " + tag.height + " " + tag.Full_Info.time_diging + " " + tag.Full_Info.power + " " + tag.Full_Info.lvl); } makeExcel(btc); Console.ReadLine(); }
public override void DataBind() //¡Ô¨¡ÃÃÁ { DataView dv, dv1; Connection Conn = new Connection(); BTC btc = new BTC(); string strSql = " Select a.ActivityCode, '¡Ô¨¡ÃÃÁ - ' + a.ActivityName ActivityName, a.Sort, Sum(b.APercent) CkAPercent, '' DeptName, b.ProjectsCode, b.IndicatorsCode, '' As FullName " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode, '¡Ô¨¡ÃÃÁ - ' + a.ActivityName ActivityName, a.Sort, Sum(b.APercent) CkAPercent, '' DeptName, b.ProjectsCode, b.IndicatorsCode, '' As FullName " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode, '¡Ô¨¡ÃÃÁ - ' + a.ActivityName ActivityName, a.Sort, Sum(b.APercent) CkAPercent, '' DeptName, b.ProjectsCode, b.IndicatorsCode, '' As FullName " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv = Conn.Select(strSql + " Group By a.ActivityCode, a.ActivityName, a.Sort, b.ProjectsCode, b.IndicatorsCode Order By a.Sort"); for (int j = 0; j < dv.Count; j++) { dv[j]["DeptName"] = btc.getAcDeptName(dv[j]["ActivityCode"].ToString()); } double CkAPercent; string strColor; string strEva = ""; for (int i = 0; i < dv.Count; i++) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.ActivityCode = '" + dv[i]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.ActivityCode = '" + dv[i]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + Request.QueryString["pjid"] + "' " + " And b.ActivityCode = '" + dv[i]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv1 = Conn.Select(strSql); CkAPercent = (Convert.ToDouble(dv[i]["CkAPercent"]) * 100) / (Convert.ToDouble(dv1.Count) * 100); if (CkAPercent < 50) { strColor = "Red";//"#f87373"; strEva = "(äÁè¼èÒ¹)"; } else { strColor = "#0B610B"; strEva = "(¼èÒ¹)"; } dv[i]["FullName"] = string.Format("<img onclick=\"getPopUpActivity('{5}')\" src=\"../Image/icon/" + ((CkAPercent >= 50) ? "ballg" : "ballr") + ".png\" style=\"border:none;width:32px;height:35px;\"/> <span onclick=\"GoToIndicators2('{5}', '{6}', '{7}');\" style=\"color:" + ((rbtlView1.Checked) ? "#6E6E6E" : strColor) + ";font-size:" + btc.fontView2 + "pt;font-weight:bold;width:630px;overflow:hidden;\" title=\"{4}\">{0}</span><span style=\"width:100px; text-align:right ;float:right; margin:20px 20px 0 0;color:" + strColor + ";font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{2}</span><span style=\"width:50px; text-align:right; float:Right; padding:20px 55px 0 0; color:" + strColor + "; font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{1}</span><span style=\"float:right; width:120px; padding:20px 45px 0 0; color:" + strColor + "; font-size:" + btc.fontView2 + "pt; text-align:right; font-weight:bold;\">{3}%</span><p style=\"clear:both; float:none;\"></p><hr />", (dv[i]["ActivityName"].ToString().Length > btc.strCut4 ? dv[i]["ActivityName"].ToString().Substring(0, btc.strCut4) + "..." : dv[i]["ActivityName"]), "", strEva, " " + CkAPercent.ToString("#,##0.00") + " ", dv[i]["DeptName"], dv[i]["ActivityCode"].ToString(), Request.QueryString["pjid"], Request.QueryString["idtid"]); //tNodeActivity.Text = string.Format("<img src=\"../Image/icon/" + ((CkAPercent >= 50) ? "icon5g" : "icon5r") + ".png\" style=\"float:left;border:none;padding:0 0 0 35px;\"/> <span title=\"˹èǧҹ : {3}\" style=\"font-size:11pt;color:" + ((rbtlView1.Checked) ? "#6E6E6E" : strColor) + ";\">{0}</span> <span style=\"font-size:12pt;color:" + strColor + ";\">{2}%</span> <span style=\"font-size:12pt;color:" + strColor + ";\">{1}</span>", dv[i]["ActivityName"].ToString(), strEva, CkAPercent.ToString("#,##0.00"), dv[i]["DeptName"].ToString()); Repeater1.DataSource = dv; Repeater1.DataBind(); } }
private void getProjects() //â¤Ã§¡Òà { DataView dv, dv1, dv2; Connection Conn = new Connection(); BTC btc = new BTC(); string strSql = " Select a.ProjectsCode, 'â¤Ã§¡Òà - ' + a.ProjectsName ProjectsName, a.Sort " + " From Projects a, Evaluation b, Activity c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And c.DelFlag = 0 " + " And b.ActivityCode = c.ActivityCode And c.ProjectsCode = a.ProjectsCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ProjectsCode, 'â¤Ã§¡Òà - ' + a.ProjectsName ProjectsName, a.Sort " + " From Projects a, Evaluation b, Activity c, dtAcDept d " + " Where a.DelFlag = 0 And b.DelFlag = 0 And c.DelFlag = 0 " + " And b.ActivityCode = c.ActivityCode And c.ProjectsCode = a.ProjectsCode And c.ActivityCode = d.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And d.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ProjectsCode, 'â¤Ã§¡Òà - ' + a.ProjectsName ProjectsName, a.Sort " + " From Projects a, Evaluation b, Activity c, dtAcEmp d " + " Where a.DelFlag = 0 And b.DelFlag = 0 And c.DelFlag = 0 " + " And b.ActivityCode = c.ActivityCode And c.ProjectsCode = a.ProjectsCode And c.ActivityCode = d.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And d.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv = Conn.Select(strSql + " Group By a.ProjectsCode, a.ProjectsName, a.Sort Order By a.Sort "); double CkAPercent = 0; string strColor = "#2b8216"; string strEva; for (int i = 0; i < dv.Count; i++) { CkAPercent = 0; strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv1 = Conn.Select(strSql + " Group By a.ActivityCode, a.ActivityName, a.Sort Order By a.Sort"); double AcPercent = 0; for (int j = 0; j < dv1.Count; j++) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv1[j]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv1[j]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And a.ProjectsCode = '" + dv[i]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv1[j]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv2 = Conn.Select(strSql); AcPercent += (Convert.ToDouble(dv1[j]["CkAPercent"]) * 100) / (Convert.ToDouble(dv2.Count) * 100); } CkAPercent = (AcPercent * 100) / (Convert.ToDouble(dv1.Count) * 100); if (CkAPercent < 50) { strColor = "Red";//"#f87373"; strEva = "(äÁè¼èÒ¹)"; } else { strColor = "#0B610B"; strEva = "(¼èÒ¹)"; } lblSummarize.Text = string.Format("<img src=\"../Image/icon/" + ((CkAPercent >= 50) ? "ballg" : "ballr") + ".png\" style=\"border:none;width:36px;height:39px;\"/> <span style=\"color:" + ((rbtlView1.Checked) ? "#5E610B" : strColor) + ";font-size:" + btc.fontView1 + "pt;font-weight:bold;width:630px;overflow:hidden;\" title=\"{4}\">{0}</span><span style=\"width:110px; text-align:right ;float:right; margin:20px 20px 0 0;color:" + strColor + ";font-size:" + btc.fontView1 + "pt; font-weight:bold;\">{2}</span><span style=\"width:50px; text-align:right; float:Right; padding:20px 55px 0 0; color:" + strColor + "; font-size:" + btc.fontView1 + "pt; font-weight:bold;\">{1}</span><span style=\"float:right; width:120px; padding:20px 50px 0 0; color:" + strColor + "; font-size:" + btc.fontView1 + "pt; text-align:right; font-weight:bold;\">{3}%</span><p style=\"clear:both; float:none;\"></p><hr />", (dv[i]["ProjectsName"].ToString().Length > btc.strCut4 ? dv[i]["ProjectsName"].ToString().Substring(0, btc.strCut4) + "..." : dv[i]["ProjectsName"]), "", strEva, " " + CkAPercent.ToString("#,##0.00") + " ", dv[i]["ProjectsName"]); DataView dvHead = Conn.Select("Select Top 1 a.SideCode, a.SideName, b.StandardCode, 'Áҵðҹ·Õè ' + Cast(b.Sort As nVarChar) As StandardName, c.IndicatorsCode, 'µÑǺ觪Õé·Õè ' + Cast(b.Sort As nVarChar) + '.' + Cast(c.Sort As nVarChar) As IndicatorsName, d.ProjectsCode, d.ProjectsName From Side a, Standard b, Indicators c, Projects d, Evaluation e Where a.SideCode = b.SideCode And b.StandardCode = c.StandardCode And d.ProjectsCode = e.ProjectsCode And e.IndicatorsCode = c.IndicatorsCode And c.IndicatorsCode = '" + Request.QueryString["idtid"] + "' And e.ProjectsCode = '" + Request.QueryString["pjid"] + "'"); Repeater2.DataSource = dvHead; Repeater2.DataBind(); } }
public void getStandard() //Áҵðҹ { DataView dv, dv1, dv2, dv3, dv4; Connection Conn = new Connection(); BTC btc = new BTC(); string strSql = " Select b.StandardCode, 'Áҵðҹ·Õè ' + Cast(b.Sort As nVarChar) + '. - ' + b.StandardName as StandardName, " + " IsNull(Sum(c.WeightScore), 0) WeightScore, b.Sort, '' As FullName, b.ScoreGroupID " + " From Side a Left Join Standard b On a.SideCode = b.SideCode " + " Left Join Indicators c On b.StandardCode = c.StandardCode " + " Where a.DelFlag = 0 And b.DelFlag = 0 And c.DelFlag = 0 " + " And a.StudyYear = '" + ddlYearB.SelectedValue + "' And b.StudyYear = '" + ddlYearB.SelectedValue + "' " + " And b.StandardCode = '" + Request.QueryString["stdid"] + "' " + " Group By b.StandardCode, StandardName, b.Sort " + " Order By b.Sort "; dv = Conn.Select(strSql); double CkCriterion = 0; string strColor = "black"; double SummarizeAvg = 0; double SummarizeCount = 0; if (dv.Count != 0) { for (int i = 0; i < dv.Count; i++) { strSql = " Select b.IndicatorsCode, b.WeightScore, Cast(a.Sort As nVarChar) + '.' + Cast(b.Sort As nVarChar) + ' - ' + SubString(b.IndicatorsName,1,80) + ' ( ' + Cast(b.WeightScore As nVarChar) + ' )' As IndicatorsName " + " From Standard a Left Join Indicators b On a.StandardCode = b.StandardCode " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.StudyYear = '" + ddlYearB.SelectedValue + "' " + " And b.StandardCode = '" + dv[i]["StandardCode"].ToString() + "' Order By a.Sort, b.Sort "; dv1 = Conn.Select(strSql); double IndPercent = 0; double ckIndScore = 0; for (int j = 0; j < dv1.Count; j++) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv2 = Conn.Select(strSql + " Group By a.ProjectsCode "); double PjPercent = 0; for (int k = 0; k < dv2.Count; k++) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv3 = Conn.Select(strSql + " Group By a.ActivityCode, a.ActivityName, a.Sort Order By a.Sort"); double AcPercent = 0; for (int l = 0; l < dv3.Count; l++) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv3[l]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv3[l]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv1[j]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv2[k]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv3[l]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv4 = Conn.Select(strSql); AcPercent += (Convert.ToDouble(dv3[l]["CkAPercent"]) * 100) / (Convert.ToDouble(dv4.Count) * 100); } PjPercent += (AcPercent * 100) / (Convert.ToDouble(dv3.Count) * 100); } if (dv2.Count != 0) { IndPercent = (PjPercent * 100) / (Convert.ToDouble(dv2.Count) * 100); } else { IndPercent = 0; } double IndScore = 0; IndScore = (IndPercent * Convert.ToDouble(dv1[j]["WeightScore"])) / 100; //string[] IndCriterion = new BTC().ckTCriteria(Convert.ToDouble(dv1[j]["WeightScore"]), IndScore).Split(':'); //ckIndScore += Convert.ToDouble(IndCriterion[0]); ckIndScore += Convert.ToDouble(IndScore.ToString("#0.00")); } double hScore = 0; //hScore = (ckIndScore / Convert.ToDouble(dv1.Count)); hScore = ckIndScore; string[] Tcriterion = new BTC().ckTCriteria(Convert.ToDouble(dv[i]["ScoreGroupID"]).ToString(), hScore).Split(':'); double ckScore = Convert.ToDouble(Tcriterion[0]); string ckTranslation = Tcriterion[1].ToString(); //strColor = btc.getColorMaster(hScore, Convert.ToDouble(dv[i]["WeightScore"])); if (ckScore > 1) { strColor = "#0B610B"; } else { strColor = "Red"; } double ckPercen = (hScore * 100) / Convert.ToDouble(dv[i]["WeightScore"]); SummarizeCount += ckScore; lblSummarize.Text = string.Format("<img src=\"../Image/icon/" + ((ckScore > 1) ? "ballg" : "ballr") + ".png\" style=\"border:none;width:36px;height:39px;\"/> <span style=\"color:" + ((rbtlView1.Checked) ? "#08088A" : strColor) + ";font-size:" + btc.fontView1 + "pt;font-weight:bold;width:600px;overflow:hidden;\" title=\"{5}\">{0}</span><span style=\"width:100px; text-align:right ;float:right; margin:20px 20px 0 0;color:" + strColor + ";font-size:" + btc.fontView1 + "pt; font-weight:bold;\">{2}</span><span style=\"width:50px; text-align:right; float:Right; padding:20px 58px 0 0; color:" + strColor + "; font-size:" + btc.fontView1 + "pt; font-weight:bold;\">{1}</span><span style=\"float:right; width:70px; padding:20px 60px 0 0; color:" + strColor + "; font-size:" + btc.fontView1 + "pt; text-align:right; font-weight:bold;\">{3}</span><span style=\"float:right; padding:20px 120px 0 0; color:#000000; font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{4}</span><p style=\"clear:both; float:none;\"></p><hr />", (dv[i]["StandardName"].ToString().Length > btc.strCut4 ? dv[i]["StandardName"].ToString().Substring(0, btc.strCut4) + "..." : dv[i]["StandardName"]), ckScore, ckTranslation, " " + hScore.ToString("#,##0.00") + " ", dv[i]["WeightScore"], dv[i]["StandardName"]); } } else { lblSummarize.Text = ""; } DataView dvHead = Conn.Select("Select a.SideCode, a.SideName, b.StandardCode, 'Áҵðҹ·Õè ' + Cast(b.Sort As nVarChar) As StandardName From Side a, Standard b Where a.SideCode = b.SideCode And b.StandardCode = '" + Request.QueryString["stdid"] + "'"); Repeater2.DataSource = dvHead; Repeater2.DataBind(); }
public override void DataBind() //µÑǺ觪Õé { DataView dv, dv1, dv2, dv3; Connection Conn = new Connection(); BTC btc = new BTC(); string strSql = " Select b.IndicatorsCode, b.WeightScore, 'µÑǺ觪Õé·Õè ' + Cast(a.Sort As nVarChar) + '.' + Cast(b.Sort As nVarChar) + ' - ' + b.IndicatorsName As IndicatorsName, '' As FullName, b.ScoreGroupID " + " From Standard a Left Join Indicators b On a.StandardCode = b.StandardCode " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.StudyYear = '" + ddlYearB.SelectedValue + "' " + " And b.StandardCode = '" + Request.QueryString["stdid"] + "' Order By a.Sort, b.Sort "; dv = Conn.Select(strSql); double CkCriterion = 0; string strColor = "#2b8216"; for (int i = 0; i < dv.Count; i++) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ProjectsCode From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv1 = Conn.Select(strSql + " Group By a.ProjectsCode "); double PjPercent = 0; for (int j = 0; j < dv1.Count; j++) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode, a.ActivityName, a.Sort, Sum(b.APercent) CkAPercent " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv2 = Conn.Select(strSql + " Group By a.ActivityCode, a.ActivityName, a.Sort Order By a.Sort"); double AcPercent = 0; for (int k = 0; k < dv2.Count; k++) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv2[k]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' "; if (ddlSearchDept.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcDept c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv2[k]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.DeptCode = '" + ddlSearchDept.SelectedValue + "' "; } if (ddlSearchEmp.SelectedIndex != 0) { strSql = " Select a.ActivityCode " + " From Activity a, Evaluation b, dtAcEmp c " + " Where a.DelFlag = 0 And b.DelFlag = 0 And a.ActivityCode = b.ActivityCode And a.ActivityCode = c.ActivityCode " + " And b.IndicatorsCode = '" + dv[i]["IndicatorsCode"].ToString() + "' And a.ProjectsCode = '" + dv1[j]["ProjectsCode"].ToString() + "' " + " And b.ActivityCode = '" + dv2[k]["ActivityCode"].ToString() + "' " + " And b.StudyYear = '" + ddlYearB.SelectedValue + "' And b.SchoolID = '" + CurrentUser.SchoolID + "' " + " And c.EmpCode = '" + ddlSearchEmp.SelectedValue + "' "; } dv3 = Conn.Select(strSql); AcPercent += (Convert.ToDouble(dv2[k]["CkAPercent"]) * 100) / (Convert.ToDouble(dv3.Count) * 100); } PjPercent += (AcPercent * 100) / (Convert.ToDouble(dv2.Count) * 100); } if (dv1.Count != 0) { CkCriterion = (PjPercent * 100) / (Convert.ToDouble(dv1.Count) * 100); } else { CkCriterion = 0; } double avg = 0; avg = CkCriterion; double hScore = 0; hScore = (avg * Convert.ToDouble(dv[i]["WeightScore"])) / 100; string[] Tcriterion = new BTC().ckTCriteria(Convert.ToDouble(dv[i]["ScoreGroupID"]).ToString(), hScore).Split(':'); double ckScore = Convert.ToDouble(Tcriterion[0]); string ckTranslation = Tcriterion[1].ToString(); //strColor = btc.getColorMaster(hScore, Convert.ToDouble(dv[i]["WeightScore"])); if (ckScore > 1) { strColor = "#0B610B"; } else { strColor = "Red"; } dv[i]["FullName"] = string.Format("<img src=\"../Image/icon/" + ((ckScore > 1) ? "ballg" : "ballr") + ".png\" style=\"border:none;width:32px;height:35px;\"/> <span style=\"color:" + ((rbtlView1.Checked) ? "#045FB4" : strColor) + ";font-size:" + btc.fontView2 + "pt;font-weight:bold;width:630px;overflow:hidden;\" title=\"{5}\">{0}</span><span style=\"width:100px; text-align:right ;float:right; margin:20px 20px 0 0;color:" + strColor + ";font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{2}</span><span style=\"width:50px; text-align:right; float:Right; padding:20px 55px 0 0; color:" + strColor + "; font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{1}</span><span style=\"float:right; width:70px; padding:20px 65px 0 0; color:" + strColor + "; font-size:" + btc.fontView2 + "pt; text-align:right; font-weight:bold;\">{3}</span><span style=\"float:right; padding:20px 115px 0 0; color:#000000; font-size:" + btc.fontView2 + "pt; font-weight:bold;\">{4}</span><p style=\"clear:both; float:none;\"></p><hr />", (dv[i]["IndicatorsName"].ToString().Length > btc.strCut4 ? dv[i]["IndicatorsName"].ToString().Substring(0, btc.strCut4) + "..." : dv[i]["IndicatorsName"]), ckScore, ckTranslation, " " + hScore.ToString("#,##0.00") + " ", dv[i]["WeightScore"], dv[i]["IndicatorsName"]); Repeater1.DataSource = dv; Repeater1.DataBind(); } }
protected void btAdd_Click(object sender, EventArgs e) { BTC btc = new BTC(); btc.txtEnable(table1, TableSearch, GridView1, true); }
protected string FileSize(object file) { return(BTC.GetSize((long)Folder.Size(file.ToString(), false))); //return FileManager.GetSize((long)Size(file.ToString(), false)); }
protected void ddlMyMainMenu_SelectedIndexChanged(object sender, EventArgs e) { BTC btc = new BTC(); btc.GenSort(txtSort, "MySubMenu", " And MyMainMenuID = '" + ddlMyMainMenu.SelectedValue + "'"); }
protected void btSave_Click(object sender, EventArgs e) { BTC btc = new BTC(); Connection Conn = new Connection(); string ExcelName = Session["ExcelName"].ToString(); DataTable dtTable; dtTable = getDataByWorksheet(ExcelName); //string CkAccxCode = dtTable.Rows[0]["AccxCode"].ToString(); //DataView dv = Conn.Select(string.Format("Select AccxCode, DeptID, MonthB, YearB, TypeB, CreateUser, CreateDate From DataInput Where AccxCode = '" + CkAccxCode + "' And DeptID = '" + ddlDepartment.SelectedValue + "' And MonthB = '" + ddlMonth.SelectedValue + "' And YearB = '" + txtYear.Text + "' And TypeB = '" + ddlBudget.SelectedValue + "' ")); //if (dv.Count > 0) //{ // string CkCreateUser = dv.Table.Rows[0]["CreateUser"].ToString(); // DateTime CkCreateDate = Convert.ToDateTime(dv.Table.Rows[0]["CreateDate"]); // Int32 j = Conn.Delete("DataInput", " Where DeptID = " + ddlDepartment.SelectedValue + " And MonthB = " + ddlMonth.SelectedValue + " And YearB = " + txtYear.Text + " And TypeB = " + ddlBudget.SelectedValue + " "); // try // { // StringBuilder sql = new StringBuilder(); // for (int i = 0; i <= dtTable.Rows.Count - 1; i++) // { // sql.AppendFormat(" INSERT INTO DataInput (AccxCode, AccxThaiName, DabitMonth, CreditMonth, DabitTotal, CreditTotal, DeptID, MonthB, YearB, TypeB, CkTrue, CreateUser, CreateDate, UpdateUser, UpdateDate)VALUES('" + dtTable.Rows[i]["AccxCode"] + "', '" + dtTable.Rows[i]["AccxThaiName"] + "', " + dtTable.Rows[i]["jrdtdebt"] + ", " + dtTable.Rows[i]["jrdtcrdt"] + ", " + dtTable.Rows[i]["DebitTotal"] + ", " + dtTable.Rows[i]["CreditTotal"] + ", '" + ddlDepartment.SelectedValue + "', " + ddlMonth.SelectedValue + ", " + txtYear.Text + ", " + ddlBudget.SelectedValue + ", " + dtTable.Rows[i]["CkTrue"] + ", '" + CkCreateUser + "', '" + CkCreateDate.AddYears(-543).ToString("M/d/yyyy HH:mm:ss") + "', '" + CurrentUser.ID + "', '" + DateTime.Now.AddYears(-543).ToString("M/d/yyyy HH:mm:ss") + "')"); // } // Conn.Execute(sql.ToString()); // } // catch (Exception) // { // Label1.Text = "Error"; // } //} //else //{ DataView dvSchoolCode = Conn.Select("Select SchoolID From MR_School Where DelFlag = 0 Order By Sort"); string SchoolCode = dvSchoolCode[0]["SchoolID"].ToString(); try { StringBuilder sql = new StringBuilder(); for (int i = 0; i <= dtTable.Rows.Count - 1; i++) { DataView dvUserName = Conn.Select("Select UserName From Employee Where DelFlag = 0 And UserName = '******'"); if (dvUserName.Count == 0) { string NewID = Guid.NewGuid().ToString(); sql.AppendFormat(" INSERT INTO Employee (EmpID, UserName, Pwd, EmpName, Email, Tel, SchoolID, DeptCode, UserRoleID, DelFlag, CreateUser, CreateDate, UpdateUser, UpdateDate)VALUES('" + NewID + "', '" + dtTable.Rows[i]["UserName"] + "', '+iSBLchCynpqcAk6Uu/Ung==', '" + dtTable.Rows[i]["EmpName"] + "', '" + dtTable.Rows[i]["Email"] + "', '" + dtTable.Rows[i]["Tel"] + "', '" + SchoolCode + "', '" + dtTable.Rows[i]["DeptCode"] + "', '68486861-2c0c-40f7-91e0-acd1c035c911', 0, '" + CurrentUser.ID + "', '" + DateTime.Now.AddYears(-543).ToString("M/d/yyyy HH:mm:ss") + "', '" + CurrentUser.ID + "', '" + DateTime.Now.AddYears(-543).ToString("M/d/yyyy HH:mm:ss") + "')"); } } Conn.Execute(sql.ToString()); Session.Remove("ExcelName"); Session.Remove("DataInput"); Cktxt(true); ClealAll(); DelFile(ExcelName); Response.Redirect("EmployeeView.aspx?mode=1&Cr=1"); } catch (Exception) { Label1.Text = "Error"; Session.Remove("ExcelName"); Session.Remove("DataInput"); Cktxt(true); ClealAll(); DelFile(ExcelName); Msg_Head(true, "4", 0, ""); } //} string script = string.Format("document.getElementById('{0}').style.display='{1}';", btImport.ClientID, "block"); script += string.Format("document.getElementById('{0}').style.display='{1}';", btSave.ClientID, "none"); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ClearbtImport", script, true); }
protected void ddlProvince_OnSelectedIndexChanged(object sender, EventArgs e) { BTC btc = new BTC(); btc.GenSort(txtSort, "Amphur", " And ProvinceID = '" + ddlProvince.SelectedValue + "' "); }