protected override void OnInit(EventArgs e) { if (!IsPostBack && !Program.Settings.IsValid) { BTC.DisplayInValidLicense(Page); } //base.OnInit; BTC btc = new BTC(); DataView dv = btc.getMasterSchool(); if (dv.Count != 0) { if (Convert.ToInt32(dv[0]["ckExpDate"]) == 0) { if (CurrentUser.ID != "4C3E218F-D513-416E-BD10-B4F161717F70") { Response.Redirect("../Setting/UnderConstruction2.aspx"); } } if (Convert.ToInt32(dv[0]["IsCon"]) == 1) { if (btc.ckGetAdmission(CurrentUser.UserRoleID) != 1) { Response.Redirect("../Setting/UnderConstruction.aspx"); } } } }
private void getUser() { BTC btc = new BTC(); DataView dv = btc.getMasterSchool(); if (dv.Count != 0) { lblConUser.Text = btc.getEmpName(dv[0]["ConUser"].ToString()) + " : ผู้รับผิดชอบ"; } }
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(); }