Example #1
0
    private void TableUnit()
    {
        DataTable dataTable    = (DataTable)this.Session["TEMPRESOURCE"];
        DataTable tempResource = TaskBookAction.GetTempResource(this.ViewState["UserCode"].ToString());

        tempResource.Columns.Add("Amount", typeof(decimal));
        tempResource.Columns.Add("TotalPrice", typeof(decimal));
        if (dataTable.Rows.Count == 0)
        {
            this.Session["TEMPRESOURCE"] = tempResource;
        }
        else
        {
            for (int i = 0; i < tempResource.Rows.Count; i++)
            {
                bool flag = true;
                for (int j = 0; j < dataTable.Rows.Count; j++)
                {
                    if (dataTable.Rows[j]["ResourceCode"].ToString().Trim() == tempResource.Rows[i]["ResourceCode"].ToString().Trim())
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    dataTable.ImportRow(tempResource.Rows[i]);
                }
            }
            this.Session["TEMPRESOURCE"] = dataTable;
        }
        this.GridBind(((DataTable)this.Session["TEMPRESOURCE"]).DefaultView);
    }