示例#1
0
    private void GenTableQCData(ref Table dTable, string user_id, string fact_no, string dept_no)
    {
        string cssClass = "";
        BasicData bd = new BasicData();
        DataTable dtData = bd.GetQCFactDept(user_id, fact_no, dept_no, "");

        PccErrMsg myLabel = new PccErrMsg(Server.MapPath("~") + "/XmlDoc", Session["CodePage"].ToString(), "Label");

        int i = 0;
        foreach (DataRow dr in dtData.Rows)
        {
            if (i % 2 == 1) cssClass = "cssGridRowDetailsAlternating";
            else cssClass = "cssGridRow";

            i++;
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();

            cell.Text = dr["fact_no"].ToString();// Xưởng
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["dept_name"].ToString();// Bộ Phận
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["sec_no"].ToString();// Mã Tổ
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["sec_name"].ToString();// Tên Tổ
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            #region type_check

            cell = new TableCell();
            cell.Text = BasicData.GetTypeName(dr["type_Check"].ToString(), myLabel);// Loại Tổ
            cell.Width = Unit.Pixel(200);
            cell.CssClass = cssClass;
            row.Cells.Add(cell);
            #endregion

            string id = user_id.Split('.')[0] + "-" + dr["fact_no"].ToString().Trim() + "-" + dr["dept_no"].ToString().Trim() + "-" + dr["sec_no"].ToString().Trim();

            Image imgDelete = new Image();
            imgDelete.ImageUrl = "~/Images/Icon/delete.gif";
            imgDelete.Style["cursor"] = "pointer";
            imgDelete.Attributes.Add("onclick", "DeleteQCFactDept('" + id + "');");

            cell = new TableCell();
            cell.Controls.Add(imgDelete);
            cell.CssClass = cssClass;

            row.Cells.Add(cell);

            dTable.Rows.Add(row);
        }
        if (dtData.Rows.Count == 0)
        {
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();
            cell.Text = "No Data";
            cell.CssClass = "cssGridRow";
            cell.ColumnSpan = 6;
            row.Cells.Add(cell);
            dTable.Rows.Add(row);

        }
    }
    private void LoadData()
    {
        string user_id = Request.Params["user_id"];
        string fact_no = BasicData.GetFactByUser(user_id);
        string dept_no = ddlDept.SelectedValue;
        string build_no = ddlBuild.SelectedValue;
        string floor = ddlFloor.SelectedValue;

        try
        {

            BasicData bd = new BasicData();
            DataTable dtData = bd.GetSecERP(fact_no, dept_no, build_no, floor);
            dtQCFactDept = bd.GetQCFactDept(user_id, fact_no);

            gvData.DataSource = dtData;
            gvData.DataBind();
        }
        catch { }
    }