public static string ListSeeds() { int memberID = HttpContext.Current.Session["MemberID"].ToInt(); var info = SeedProcess_Data.GetList(memberID, DateTime.Now); string result = ""; for (int i = 0; i < info.Rows.Count; i++) { DateTime StartTime = Convert.ToDateTime(info.Rows[i]["DateOfManufacture"]); DateTime EndTime = new DateTime(); if (info.Rows[i]["EndTime"].ToString() != "") { EndTime = Convert.ToDateTime(info.Rows[i]["EndTime"]); } //if (EndTime > DateTime.Now) { result += @"<table data-toggle='table' data-url='data1.json' data-cache='false' data-height='299' style='margin-bottom: -10px;margin-top: -10px;'> <thead> <tr> <th class='col-sm-2'><img src='" + info.Rows[i]["Images"].ToString().Replace("..", "http://admin.vietgap.info") + "' style='width:80px;height:80px'/></th>" + "<th class='col-sm-10'><font color='rgb(87, 7, 65)'>" + info.Rows[i]["SeedsName"] + "</font><br />Ngày trồng : <b>" + StartTime.ToString("dd-MM-yyyy") + "</b><br />Ngày thu hoạch: <b>" + EndTime.ToString("dd-MM-yyyy") + "</b></th>" + @"</tr> </thead> </table><hr/>"; } } return(result); }
protected void GrDelete(object sender, CommandEventArgs e) { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; nUserLogin.CheckRole("CU0001"); if (!nUserLogin.Role.Del) { Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>"); } else { try { int mKey = int.Parse(e.CommandArgument.ToString()); SeedProces_Info info = new SeedProces_Info(mKey); info.Delete(); DataTable nTable = SeedProcess_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber, DDLSeeds.SelectedValue.ToInt()); if (nTable.Rows.Count == 0) { nTable.Rows.Add(0, 0, "", 0, 0, 0, "", "", 0, "", "", "", 0, 0, null, null, 0, 0, 0, "", 0, 0, "", "", "", 0, ""); } GV_SeedProcess.DataSource = nTable; GV_SeedProcess.DataBind(); LoadPages(); } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }
protected void cmdView_Click1(object sender, ImageClickEventArgs e) { txtPageNumber.Text = "1"; int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; DateTime dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime dtto = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); DataTable nTable = SeedProcess_Data.GetList(dtfrom, dtto, Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber, DDLSeeds.SelectedValue.ToInt()); GV_SeedProcess.DataSource = nTable; GV_SeedProcess.DataBind(); LoadPages(); }
public static string Listwork(string time) { string result = ""; int memberID = HttpContext.Current.Session["MemberID"].ToInt(); var infos = SeedProcess_Data.GetList(time, memberID); if (infos.Rows.Count > 0) { for (int i = 0; i < infos.Rows.Count; i++) { result += "$" + infos.Rows[i]["SeedProcessKey"].ToString() + "-" + infos.Rows[i]["SeedsName"].ToString(); } } return(result); }
private void LoadData() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; DataTable nTable = SeedProcess_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber, DDLSeeds.SelectedValue.ToInt()); if (nTable.Rows.Count == 0) { nTable.Rows.Add(0, 0, "", 0, 0, 0, "", "", 0, "", "", "", 0, 0, null, null, 0, 0, 0, "", 0, 0, "", "", "", 0, ""); } GV_SeedProcess.DataSource = nTable; GV_SeedProcess.DataBind(); txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy"); txttoDatetime.Text = DateTime.Now.ToString("dd/MM/yyyy"); LoadPages(); }
protected void LoadPages() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); int nTotalRecord = SeedProcess_Data.Count(Session["EmployeeKey"].ToInt(), DDLSeeds.SelectedValue.ToInt()); if (nTotalRecord > nPageSize) { PageNumbers.Visible = true; DataTable nTable = TNLibrary.WEB.LoadDataToToolboxWeb.LoadPageSize(nPageSize, nTotalRecord, nPageNumber); PageNumbers.SelectedIndex = (nPageNumber - 1) - (int.Parse(nTable.Rows[0][0].ToString()) - 1); PageNumbers.DataSource = nTable; PageNumbers.DataBind(); } else { PageNumbers.Visible = false; } }
public static string ListDate(string Year, string Month) { int memberID = HttpContext.Current.Session["MemberID"].ToInt(); var infos = SeedProcess_Data.GetListDate(memberID, Month.ToInt(), Year.ToInt()); string cities = ""; for (int i = 0; i < infos.Rows.Count; i++) { DateTime date = DateTime.Parse(infos.Rows[i]["DateOfManufacture"].ToString()); string day = date.ToString("yyyy-MM-dd"); if (i + 1 < infos.Rows.Count) { cities += '"' + day + "\":{\"number\":\"" + infos.Rows[i]["Count"].ToInt() + "\"},"; } else { cities += '"' + day + "\":{\"number\":\"" + infos.Rows[i]["Count"].ToInt() + "\"}"; } } cities = "{" + cities + "}"; return(cities); }