コード例 #1
0
ファイル: CurrentRunResult.aspx.cs プロジェクト: viticm/pap2
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.Params["SerialNum"] != null)
                HyperLinkDetail.NavigateUrl = "../GameServer/ServerOperationHistory.aspx?SerialNum=" + Request.Params["SerialNum"].ToString();

            TableHeaderRow header = new TableHeaderRow();
            TableHeaderCell[] head = new TableHeaderCell[2];
            for (int i = 0; i <= 1; i++) head[i] = new TableHeaderCell();
            head[0].Width = new Unit(10f, UnitType.Percentage);
            head[0].Text = StringDef.Name;
            head[1].Width = new Unit(30f, UnitType.Percentage);
            head[1].Text = StringDef.Message;

            header.Cells.AddRange(head);
            ResultList.Rows.Add(header);

            if (Session["ActionResultList"] == null)
            {
                TableRow row = new TableRow();
                TableCell[] cell = new TableCell[2];
                for (int i = 0; i <= 1; i++) cell[i] = new TableCell(); ;
                cell[0].Text = "";
                cell[1].Text = "Çë²é¿´ÈÕÖ¾";
                row.Cells.AddRange(cell);
                ResultList.Rows.Add(row);
            }
            else
            {
                ShowRunResult(Session["ActionResultList"] as IList);
            }
        }
    }
コード例 #2
0
ファイル: marks_detail_view.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {

                GridView gv3 = sender as GridView;
                GridViewRow row3 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

                Table t3 = (Table)gv3.Controls[0];

                TableCell FileDateb1 = new TableHeaderCell();
                FileDateb1.Text = "<b>Center Name:</b> " + DropDownList4.SelectedItem.Text + " | <b>Course:</b> " + DropDownList2.SelectedItem.Text + " |  <b> Period:</b> " + Convert.ToDateTime(TextBox1.Text).ToString("dd MMM, yyyy") + " to " + Convert.ToDateTime(TextBox2.Text).ToString("dd MMM, yyyy");
                FileDateb1.ColumnSpan = GridView1.Columns.Count;
                FileDateb1.Height = 50;
                FileDateb1.Font.Size = 15;
                FileDateb1.Font.Bold = true;
                row3.Cells.Add(FileDateb1);
                t3.Rows.AddAt(0, row3);
            }
        }
        catch
        {
        }
    }
コード例 #3
0
ファイル: HubInvDetail.aspx.cs プロジェクト: rivernli/pMKT
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count > 0)
        {
            Table tbl = (Table)GridView1.Controls[0];
            GridViewRow row = new GridViewRow(1, -1, DataControlRowType.Header, DataControlRowState.Normal);
            string msg = "&nbsp;";
            if (rsQty == limitQty)
                msg = "Warning: Your search result has reached the limit of the number of " + limitQty.ToString();

            TableCell th = new TableHeaderCell();
            th.ColumnSpan = 6;
            th.Text = msg;
            row.Cells.Add(th);
            TableCell thQty = new TableHeaderCell();
            thQty.Text = "Total Qty<br/>" + totalQty.ToString();
            thQty.ForeColor = System.Drawing.Color.Red;
            thQty.HorizontalAlign = HorizontalAlign.Right;
            row.Cells.Add(thQty);
            TableCell thAmt = new TableHeaderCell();
            thAmt.Text = "Total Amount<br/>" + totalAmt.ToString();
            row.Cells.Add(thAmt);
            thAmt.ForeColor = System.Drawing.Color.Red;
            thAmt.HorizontalAlign = HorizontalAlign.Right;
            TableCell th2 = new TableHeaderCell();
            th2.ColumnSpan = 8;
            th2.Text = "&nbsp";
            row.Cells.Add(th2);
            tbl.Rows.AddAt(1, row);
        }
    }
コード例 #4
0
    protected void DropDownListSuppliers_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownListSuppliers.SelectedIndex == 0) return;

        List<List<string>> lProd = NorthwindAccess.GetProducts(DropDownListSuppliers.SelectedValue);

        TableHeaderRow thr = new TableHeaderRow();
        for (int i = 0; i < lProd[0].Count; i++)
        {
            TableHeaderCell thc = new TableHeaderCell();
            thc.Text = lProd[0][i];
            thr.Cells.Add(thc);
        }

        tableProducts.Rows.Add(thr);

        for (int i = 1; i < lProd.Count; i++)
        {
            TableRow tr = new TableRow();
            for (int ii = 0; ii < lProd[i].Count; ii++)
            {
                TableCell tc = new TableCell();
                tc.Text = lProd[i][ii];
                tr.Cells.Add(tc);
            }
            tableProducts.Rows.Add(tr);
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        v1txtName.Focus();

        //count is used to populate the number of rows in the view2 table
        //it is based on the number entered in the v1txtFields TextBox
        int count;
        try
        {
            if (v1txtFields.Text.Trim().Length > 0)//if a value is present at all
            {
                count = int.Parse(v1txtFields.Text.Trim());//get the number from v1txtFields TextBox

                //set the table columns and headers
                TableHeaderRow thr = new TableHeaderRow();
                TableHeaderCell thFieldName = new TableHeaderCell();
                TableHeaderCell thDataType = new TableHeaderCell();
                TableHeaderCell thRequired = new TableHeaderCell();
                thFieldName.Text = "Field Name";
                thDataType.Text = "Data Type";
                thRequired.Text = "Required";
                thr.Cells.Add(thFieldName);
                thr.Cells.Add(thDataType);
                thr.Cells.Add(thRequired);
                v2table.Rows.Add(thr);

                //populate the table with new text boxes, drop lists, and validators
                for (int i = 0; i < count; i++)
                {
                    TableRow tr = new TableRow();
                    TableCell c1 = new TableCell();//text box
                    TableCell c2 = new TableCell();//droplist
                    TableCell c3 = new TableCell();//checkbox
                    DropDownList ddl = SetDataTypeList();
                    TextBox t = new TextBox();
                    t.TabIndex = (short)(i + 1);
                    t.ID = "box" + i.ToString(); // can't validate without an ID

                    c1.Controls.Add(t);
                    c2.Controls.Add(ddl);
                    c3.Controls.Add(new CheckBox());

                    tr.Cells.Add(c1);
                    tr.Cells.Add(c2);
                    tr.Cells.Add(c3);
                    tr.Cells.Add(new TableCell()); //add a blank cell for the validator later
                    v2table.Rows.Add(tr);
                }
            }
            else //nothing is in the view 1 textbox at page load
            {
                count = 0;
            }
        }
        catch (Exception)
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Alert.Visible = false;
        LoadAllStandardOperatingProcedures();

        if (standardOperatingProcedures == null)
        {
            Alert.Visible = true;
            Alert.InnerHtml = "There are no SOPs in the database!";
        }
        else
        {
            var headerRow = new TableHeaderRow();
            var titleHeaderCell = new TableHeaderCell();
            titleHeaderCell.Text = "Title";
            var departmentHeaderCell = new TableHeaderCell();
            departmentHeaderCell.Text = "Department";
            TableHeaderCell[] headerCells = { titleHeaderCell, departmentHeaderCell };
            headerRow.Cells.AddRange(headerCells);
            StandardOperatingProcedures.Rows.Add(headerRow);

            foreach (var sop in standardOperatingProcedures)
            {
                var row = new TableRow();
                var titleCell = new TableCell();
                titleCell.Text = sop.Title;
                var departmentCell = new TableCell();
                departmentCell.Text = sop.Department;
                //var previewCell = new TableCell();
                //previewCell.Text = "<a href='"
                var viewCell = new TableCell();
                var viewButton = new Button();
                viewButton.Text = "View";
                viewButton.CommandArgument = sop.Title;
                viewButton.Command += new CommandEventHandler(ViewClick);
                viewCell.Controls.Add(viewButton);
                var downloadCell = new TableCell();
                Button downloadButton = new Button();
                downloadButton.Text = "Download";
                downloadButton.CommandArgument = sop.Title;
                downloadButton.Command += new CommandEventHandler(DownloadClick);
                downloadCell.Controls.Add(downloadButton);
                var editCell = new TableCell();
                Button editButton = new Button();
                editButton.Text = "Edit";
                editButton.CommandArgument = sop.XmlPath.Substring(sop.XmlPath.LastIndexOf('\\'));
                editButton.Command += new CommandEventHandler(EditClick);
                editCell.Controls.Add(editButton);
                TableCell[] cells = { titleCell, departmentCell, viewCell, /*previewCell,*/ downloadCell, editCell };
                row.Cells.AddRange(cells);
                StandardOperatingProcedures.Rows.Add(row);
            }
        }
    }
コード例 #7
0
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {

            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t = (Table)gv.Controls[0];

            TableCell cell1 = new TableHeaderCell();
            cell1.Text = "S. No";
            row.Cells.Add(cell1);

            TableCell cell2 = new TableHeaderCell();
            cell2.Text = "S. No. of Auction List";
            row.Cells.Add(cell2);

            TableCell cell3 = new TableHeaderCell();
            cell3.Text = "Bid Paper No.";
            row.Cells.Add(cell3);

            TableCell cell4 = new TableHeaderCell();
            cell4.Text = "Name of Purchaser";
            row.Cells.Add(cell4);

            TableCell cell5 = new TableHeaderCell();
            cell5.Text = "Lot No. Purchased";

            row.Cells.Add(cell5);

            TableCell cell6 = new TableHeaderCell();
            cell6.Text = "Stack No. Purchased";
            row.Cells.Add(cell6);

            TableCell cell7 = new TableHeaderCell();
            cell7.Text = "Species";
            row.Cells.Add(cell7);

            TableCell cell8 = new TableHeaderCell();
            cell8.Text = "Sizes";
            row.Cells.Add(cell8);

            TableCell cell9 = new TableHeaderCell();
            cell9.Text = "No.";
            row.Cells.Add(cell9);

            t.Rows.AddAt(0, row);

            Table t8 = (Table)gv.Controls[0];
        }
    }
コード例 #8
0
    /// <summary>
    /// Event triggered to perform the matchmaking algorithm
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnFindParticipants_Click(object sender, EventArgs e)
    {
        int studyID = Convert.ToInt32(Request.QueryString["study_id"]);
        Matchmaker matchmaker = new Matchmaker(new Study(studyID));
        Table tblResults = new Table();
        TableHeaderRow header = new TableHeaderRow();
        TableHeaderCell headerName = new TableHeaderCell();
        TableHeaderCell headerEmail = new TableHeaderCell();
        TableHeaderCell headerScore = new TableHeaderCell();
        headerName.Text = "Name";
        headerEmail.Text = "Email";
        headerScore.Text = "Score";
        header.Cells.Add(headerName);
        header.Cells.Add(headerEmail);
        header.Cells.Add(headerScore);
        tblResults.Rows.Add(header);
        tblResults.CellSpacing = 3;
        tblResults.CellPadding = 5;

        foreach (KeyValuePair<Participant, int> result in matchmaker.Results) {
            TableRow row = new TableRow();
            TableCell cellID = new TableCell();
            TableCell cellName = new TableCell();
            TableCell cellEmail = new TableCell();
            TableCell cellScore = new TableCell();

            cellID.Text = result.Key.UserID.ToString();
            cellID.Visible = false;
            HyperLink link = new HyperLink();
            link.ToolTip = "Click the link to view more information about this user";
            link.Text = result.Key.FirstName + " " + result.Key.LastName;
            link.NavigateUrl="ParticipantInfo.aspx?participant_id=" + cellID.Text + "&study_id=" + studyID;
            cellName.Controls.Add(link);
            cellEmail.Text = result.Key.Email;
            cellScore.Text = result.Value.ToString();

            row.Cells.Add(cellID);
            row.Cells.Add(cellName);
            row.Cells.Add(cellEmail);
            row.Cells.Add(cellScore);
            tblResults.Rows.AddAt(getIndexToAdd(tblResults, row), row);
            pnlmatchmakingResults.Controls.Add(tblResults);
        }

        if (matchmaker.Results.Count == 0) {
            lblNoResults.Visible = true;
        }

        pnlmatchmakingResults.Visible = true;
        btnEmailParticipant.Visible = true;
    }
コード例 #9
0
ファイル: AccountState.aspx.cs プロジェクト: viticm/pap2
    private void ShowState(AccountState state)
    {
        TableRow row = new TableRow();
        TableHeaderCell cell = new TableHeaderCell();
        cell.Width = new Unit(30, UnitType.Percentage);
        cell.Text = StringDef.AccountState;
        row.Cells.Add(cell);

        TableCell cell1 = new TableCell();
        cell1.Text = state.ToString();
        row.Cells.Add(cell1);

        TableResult.Rows.Add(row);
    }
コード例 #10
0
ファイル: BasePage.cs プロジェクト: Mimalef/repop
    public void fillTable(string sql, ref Table table)
    {
        DataTable dataTable = selectQuery(sql);

        TableHeaderRow th = new TableHeaderRow();

        for (int i = 0; i < dataTable.Columns.Count; i++)
        {
            TableHeaderCell cell = new TableHeaderCell();

            cell.Text = dataTable.Columns[i].ColumnName;

            th.Cells.Add(cell);
        }

        table.Rows.Add(th);

        foreach (DataRow row in dataTable.Rows)
        {
            TableRow trow = new TableRow();

            for (int i = 0; i < dataTable.Columns.Count; i++)
            {
                TableCell cell = new TableCell();

                cell.Text = row[i].ToString();

                trow.Cells.Add(cell);
            }

            if (table.ID == "TableEquip")
            {
                TableCell cell = new TableCell();
                LinkButton edit = new LinkButton();

                edit.PostBackUrl = "~/PersonnelEditEquip.aspx?equip=";
                edit.PostBackUrl += row[0].ToString();
                edit.Text = "ویرایش";

                cell.Controls.Add(edit);
                trow.Cells.Add(cell);
            }

            table.Rows.Add(trow);
        }
    }
コード例 #11
0
ファイル: GatewayInfo.aspx.cs プロジェクト: viticm/pap2
    private void ShowGatewayList(IList<GatewayInfo> list)
    {
        if (list == null || list.Count == 0)
        {
            return;
        }
        TableHeaderRow rowHead = new TableHeaderRow();
        TableHeaderCell cellHead = new TableHeaderCell();
        cellHead.Text = StringDef.GatewayName;
        rowHead.Cells.Add(cellHead);

        cellHead = new TableHeaderCell();
        cellHead.Text = StringDef.ZoneName;
        rowHead.Cells.Add(cellHead);

        cellHead = new TableHeaderCell();
        cellHead.Text = StringDef.IPAddress;
        rowHead.Cells.Add(cellHead);

        TableGatewayInfo.Rows.Add(rowHead);

        foreach (GatewayInfo info in list)
        {
            TableRow row = new TableRow();

            TableCell cell = new TableCell();
            cell.Text = info.GatewayName;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = info.ZoneName;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = info.IPAddress;
            row.Cells.Add(cell);

            TableGatewayInfo.Rows.Add(row);
        }
        LabelResult.Text = StringDef.GatewayList;
    }
コード例 #12
0
ファイル: Common.cs プロジェクト: phiree/namename
    public static void CreateHeader(string strheader, Table table, int[] widths)
    {
        string[] Headers = strheader.Split(',');

        TableHeaderRow thr = new TableHeaderRow();

        int i = 0;
        if (Headers.Length != widths.Length)
        {
            i = -1;
        }
        foreach (string s in Headers)
        {
            TableHeaderCell tc = new TableHeaderCell();
            tc.Text = s;
            if (i > -1)
            {
                tc.Width = widths[i];
                i++;
            }
            thr.Cells.Add(tc);
        }
        table.Rows.Add(thr);
    }
    public Table[] vratiTabelaNarackiKorisnik(OracleDataReader drO)
    {
        int i = 1;
        int j = 0;
        int pat = 1;
        Table[] nova = new Table[100];
        TableHeaderCell head;
        TableCell cel;
        TableRow row = new TableRow();
        TableFooterRow foot;
        nova[j] = new Table();
        while (drO.Read())
        {

            if (pat == 1)
            {
                //nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Комитент_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Маркет";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Адреса";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Град";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Датум";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Вкупно";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Платено";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Затворена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Измени";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Прикажи";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
                pat = 2;

            }
            if (i > 10)
            {
                i = 1;
                j++;
                row = new TableRow();
                nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Комитент_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Маркет";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Адреса";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Град";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Датум";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Вкупно";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Платена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Затворена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Измени";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Прегледај";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
            }
            row = new TableRow();
            cel = new TableCell();
            cel.Text = i.ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDP"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDK"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["МАРКЕТ"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["АДРЕСА"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ГРАД"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ДАТУМ"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ВКУПНО"].ToString() +",00ден";
            cel.Attributes.Add("class", "textCellLevo");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ПЛАТЕНА"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ЗАТВОРЕНА"].ToString().Trim();
            row.Controls.Add(cel);
            cel = new TableCell();
            if (drO["ЗАТВОРЕНА"].ToString().Trim() !="D")
            {
                Button izmeniBtn = new Button();
                izmeniBtn.Text = "Измени";
                izmeniBtn.ID = "izmeniBtn." + j.ToString() + "." + i.ToString();
                izmeniBtn.Click += new EventHandler(izmeniBtn_Click);
                cel.Controls.Add(izmeniBtn);
               
            }
            row.Controls.Add(cel);
            cel = new TableCell();
            Button izvestajBtn = new Button();
            izvestajBtn.Text = "Прикажи";
            izvestajBtn.ID = "izvestajBtn." + j.ToString() + "." + i.ToString();
            izvestajBtn.Click += new EventHandler(izvestajBtn_Click);
            cel.Controls.Add(izvestajBtn);
            row.Controls.Add(cel);
            nova[j].Controls.Add(row);
            i++;
        }
        Table[] kraj = new Table[j + 1];
        //for (int w = 0; w <= j; w++)
        //{
        //    foot = new TableFooterRow();
        //    cel = new TableCell();
        //    cel.ColumnSpan = 5;
        //    for (int q = 1; q <= j + 1; q++)
        //    {
        //        Button kopce = new Button();
        //        kopce.ID =q.ToString();
        //        kopce.Click += new EventHandler(kopceListaNaracki_Click);
        //        kopce.Text = q.ToString();
        //        cel.Controls.Add(kopce);
        //    }
        //    foot.Controls.Add(cel);
        //    if (nova[w] != null)
        //        nova[w].Rows.Add(foot);
        //    kraj[w] = nova[w];
        //}
        if (nova[0].Rows.Count > 0)
        {
            for (int w = 0; w <= j; w++)
            {
                foot = new TableFooterRow();
                cel = new TableCell();
                cel.ColumnSpan = 5;
                for (int q = 1; q <= j + 1; q++)
                {
                    Button kopce = new Button();
                    kopce.ID =q.ToString();
                    kopce.Click += new EventHandler(kopceListaNaracki_Click);
                    kopce.Text = q.ToString();
                    cel.Controls.Add(kopce);
                }
                foot.Controls.Add(cel);
                if (nova[w] != null)
                    nova[w].Rows.Add(foot);
                kraj[w] = nova[w];
            }
        }
        else
        {
            foot = new TableFooterRow();
            cel = new TableCell();
            cel.Text = " Нема податоци - нарачки ";
            cel.BorderColor = System.Drawing.Color.White;
            cel.BorderWidth = Unit.Pixel(2);
            cel.BorderStyle = BorderStyle.Solid;
            foot.Controls.Add(cel);
            nova[0].Rows.Add(foot);
            kraj[0] = nova[0];
        }
        return kraj;
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        config_data   = new SystemConfig().getConfig();
        academic_year = config_data.AcademicYear;
        semester      = config_data.Semester;


        Student student_data = new Student();

        row1 = Request.QueryString["show_row"];

        if (Session["showRegCourse" + row1] == null)
        {
            Response.Redirect("List_StudentRegis_SecAdvisor.aspx");
        }
        else
        {
            student_data = (Student)Session["showRegCourse" + row1];

            lblStudentName.Text = student_data.Student_ID + " " + student_data.First_ThaiName + " " + student_data.Family_ThaiName;

            if (!Page.IsPostBack)
            {
                Session.Remove("ApproveRegis");
            }

            try
            {
                string          Lecturer_ID  = (string)Session["Lecturer_ID"];
                GradAdvisorData advisor_data = new GradAdvisorData();
                advisor_data = new Student().getAdvisorCoAdvisor(student_data.Student_ID);

                if (advisor_data.Advisor_ID == null)
                {
                    lblAlertAdvisor.Text = "";
                    if (Session["ApproveRegis"] != null)
                    {
                        btnApprove.Enabled = true;
                    }
                    else
                    {
                        btnApprove.Enabled = false;
                    }
                }
                else if (advisor_data.Advisor_ID == "0")
                {
                    lblAlertAdvisor.Text = "";
                    if (Session["ApproveRegis"] != null)
                    {
                        btnApprove.Enabled = true;
                    }
                    else
                    {
                        btnApprove.Enabled = false;
                    }
                }
                else
                {
                    if (Lecturer_ID == advisor_data.Advisor_ID)
                    {
                        lblAlertAdvisor.Text = "";
                        if (Session["ApproveRegis"] != null)
                        {
                            btnApprove.Enabled = true;
                        }
                        else
                        {
                            btnApprove.Enabled = false;
                        }
                    }
                    else
                    {
                        lblAlertAdvisor.Text = "นักศึกษาได้แต่งตั้งอาจารย์ที่ปรึกษาแล้ว";
                        btnApprove.Enabled   = false;
                    }
                }


                LectuereInformationData lecturer_data = new LectuereInformationData();
                lecturer_data = new Lecturer().getLecturer(student_data.Advisor_ID);

                degree_char = student_data.Degree_Char;

                studentRegisData = new Student_Registration().getRegistration(academic_year, semester, student_data.Student_ID, degree_char);

                int        numrow = 1;
                CheckBox[] chk    = new CheckBox[studentRegisData.Count];
                txtCredit = new TextBox[studentRegisData.Count];
                int i = 0;

                // Head Table
                //string[] ar = { "ตอนที่", "รหัสวิชา", "ชื่อวิชา", "ผู้สอน", "ห้องเรียน", "เวลาเรียน", "สอบกลางภาค", "สอบปลายภาค", "อนุมัติ" };
                string[] ar  = { "ตอนที่", "รหัสวิชา", "ชื่อวิชา", "ผู้สอน", "ห้องเรียน", "เวลาเรียน", "ประเภทการลงทะเบียน", "สถานะการลงทะเบียน", "สถานะการชำระเงิน", "จำนวนหน่วยกิต", "อนุมัติ" };
                Table    tb1 = new Table();
                tb1.Attributes.Add("class", "table table-bordered table-hover table-striped");
                tb1.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    cellHead.Attributes.Add("class", "text-align-center");
                    tRowHead.Cells.Add(cellHead);
                }

                tb1.Rows.Add(tRowHead);

                List <RegistrationData> ApproveRegisData = new List <RegistrationData>();
                if (Session["ApproveRegis"] != null)
                {
                    ApproveRegisData = (List <RegistrationData>)Session["ApproveRegis"];
                }

                foreach (RegistrationData data in studentRegisData)
                {
                    teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, degree_char);

                    lec_table = degree_char;

                    // กรณีวิชาที่เพิ่มโดยอาจารย์ผู้สอน เป็นวิชาที่อยู่คนละระดับการศึกษา
                    if (teachingData.Count <= 0)
                    {
                        if (degree_char == "U" || degree_char == "B")
                        {
                            teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, "M");
                            lec_table    = "M";
                        }
                        else
                        {
                            teachingData = new TeachingTable().getSubTeachingTable(academic_year, semester, data.Course_Code, data.Sec_No, data.SubSec_No, "B");
                            lec_table    = "B";
                        }
                    }
                    //=======================

                    CourseData course_reg = new CourseData();
                    course_reg = new Course().getCourse(data.Course_Code);

                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    string course_type = "";
                    if (data.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (data.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (data.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (data.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (data.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (data.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (data.SubSec_No != 0)
                    {
                        course_type += data.SubSec_No;
                    }
                    else
                    {
                        course_type += data.Sec_No;
                    }

                    TableCell cellSec = new TableCell();
                    cellSec.Text = course_type;
                    cellSec.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellSec);

                    TableCell cellCourseCode = new TableCell();
                    cellCourseCode.Text = course_reg.Course_Code;
                    cellCourseCode.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellCourse = new TableCell();
                    cellCourse.Text = course_reg.Course_Thainame;
                    tRowBody.Cells.Add(cellCourse);

                    TableCell cellLecturer = new TableCell();
                    string    lec_name     = "";
                    foreach (TeachingTableData teach in teachingData)
                    {
                        lecturerData = new LecturerTable().getLecturerTable(teach, lec_table);
                        foreach (LecturerTableData lec in lecturerData)
                        {
                            lec_name += new Lecturer().getLecturer(lec.Lecturer).Lecturer_ShortName + ",";
                        }

                        lec_name = lec_name.Substring(0, lec_name.Length - 1);

                        lec_name += "<br>";
                    }

                    cellLecturer.Text = lec_name;
                    tRowBody.Cells.Add(cellLecturer);
                    TableCell cellRoom = new TableCell();

                    foreach (TeachingTableData teach in teachingData)
                    {
                        cellRoom.Text += teach.Building_Code + "-" + teach.Room_Code;
                        if (teach.Campus_Code == "2")
                        {
                            cellRoom.Text += "*";
                        }
                        else if (teach.Campus_Code == "3")
                        {
                            cellRoom.Text += "**";
                        }

                        cellRoom.Text += "<br/>";
                    }
                    cellRoom.Attributes.Add("class", "text-align-center");

                    tRowBody.Cells.Add(cellRoom);

                    TableCell cellTeaching = new TableCell();
                    foreach (TeachingTableData teach in teachingData)
                    {
                        string day = "";

                        if (teach.Teaching_Day == "1")
                        {
                            day = "Mon";
                        }
                        else if (teach.Teaching_Day == "2")
                        {
                            day = "Tue";
                        }
                        if (teach.Teaching_Day == "3")
                        {
                            day = "Wed";
                        }
                        if (teach.Teaching_Day == "4")
                        {
                            day = "Thu";
                        }
                        if (teach.Teaching_Day == "5")
                        {
                            day = "Fri";
                        }
                        if (teach.Teaching_Day == "6")
                        {
                            day = "Sat";
                        }
                        if (teach.Teaching_Day == "7")
                        {
                            day = "Sun";
                        }

                        cellTeaching.Text += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                        cellTeaching.Attributes.Add("class", "text-align-center");
                    }
                    tRowBody.Cells.Add(cellTeaching);

                    //TableCell cellMid = new TableCell();
                    //cellMid.Text = new utility().getThaiBirthDay(exam_data.ExamMid_Day) + " เวลา:" + exam_data.ExamMid_StartTime + "-" + exam_data.ExamMid_EndTime;
                    //tRowBody.Cells.Add(cellMid);

                    //TableCell cellFinal = new TableCell();
                    //cellFinal.Text = new utility().getThaiBirthDay(exam_data.ExamFinal_Day) + " เวลา:" + exam_data.ExamFinal_StartTime + "-" + exam_data.ExamFinal_EndTime;
                    //tRowBody.Cells.Add(cellFinal);

                    TableCell cellRegType = new TableCell();
                    cellRegType.Text = data.Reg_Type;
                    cellRegType.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellRegType);

                    TableCell cellRegStatus = new TableCell();
                    cellRegStatus.Text = statusObj.getStatus(data.Status).Status_Thai;
                    cellRegStatus.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellRegStatus);

                    TableCell cellPaymentStatus = new TableCell();
                    cellPaymentStatus.Text = statusObj.getStatus(new Student_Payment().getPaymentStatus(data.Payment_ID, degree_char)).Status_Thai;
                    cellPaymentStatus.Attributes.Add("class", "text-align-center");
                    tRowBody.Cells.Add(cellPaymentStatus);

                    TableCell cellCredit = new TableCell();
                    cellCredit.Attributes.Add("class", "text-align-center");

                    if ((data.Course_Type == "4") || (data.Course_Type == "5") || (data.Course_Type == "7"))
                    {
                        txtCredit[i]           = new TextBox();
                        txtCredit[i].ID        = "credit" + numrow.ToString();
                        txtCredit[i].MaxLength = 2;
                        txtCredit[i].Width     = 30;
                        txtCredit[i].Attributes.Add("class", "text-center");
                        txtCredit[i].Text = data.Credit.ToString();
                        if (data.Approve_Status == "y")
                        {
                            txtCredit[i].ReadOnly  = true;
                            txtCredit[i].BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
                        }
                        else
                        {
                            txtCredit[i].ReadOnly     = false;
                            txtCredit[i].AutoPostBack = true;
                            txtCredit[i].TextChanged += new EventHandler(txtCredit_TextChanged);
                        }
                        cellCredit.Controls.Add(txtCredit[i]);
                    }
                    else
                    {
                        cellCredit.Text = data.Credit.ToString();
                    }
                    tRowBody.Cells.Add(cellCredit);

                    TableCell cellchkApprove = new TableCell();

                    if (data.Approve_Status == "n")
                    {
                        chk[i] = new CheckBox();
                        chk[i].AutoPostBack = true;
                        chk[i].ID           = "approve" + numrow.ToString();

                        foreach (RegistrationData chkdata in ApproveRegisData)
                        {
                            if (data.Academic_Year == chkdata.Academic_Year && data.Semester == chkdata.Semester && data.Course_Code == chkdata.Course_Code && data.Sec_No == chkdata.Sec_No && data.SubSec_No == chkdata.SubSec_No)
                            {
                                chk[i].Checked = true;
                            }
                        }

                        chk[i].CheckedChanged += new EventHandler(chkApprove_CheckedChanged);
                        cellchkApprove.Controls.Add(chk[i]);
                        cellchkApprove.Attributes.Add("class", "text-align-center");
                    }
                    else
                    {
                        if (data.Approve_Status == "y")
                        {
                            cellchkApprove.Text = "อนุมัติ";
                            cellchkApprove.Attributes.Add("class", "txt-green-bold text-align-center");
                        }
                    }


                    tRowBody.Cells.Add(cellchkApprove);

                    numrow++;
                    i++;

                    tb1.Rows.Add(tRowBody);
                }



                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Controls.Add(tb1);
                row.Cells.Add(cell);
                tblStudentAdvisor.Rows.Add(row);
            }
            catch (Exception err)
            {
                HttpContext.Current.Session["response"] = "ไม่สามารถดำเนินการได้" + err.ToString();
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    /// <summary>
    /// Compare DataSets.
    /// </summary>
    /// <param name="ds">Original DataSet</param>
    /// <param name="compareDs">DataSet to compare</param>
    private void CompareDataSets(DataSet ds, DataSet compareDs)
    {
        Table = new Table();
        SetTable(Table);
        Table.CssClass += " NoSideBorders";

        // Ensure same tables in DataSets
        EnsureSameTables(ds, compareDs);
        EnsureSameTables(compareDs, ds);

        // Prepare list of tables
        SortedDictionary <string, string> tables = new SortedDictionary <string, string>();

        foreach (DataTable dt in ds.Tables)
        {
            string excludedTableNames = (ExcludedTableNames != null) ? ";" + ExcludedTableNames.Trim(';').ToLowerCSafe() + ";" : "";
            string tableName          = dt.TableName;
            if (!DataHelper.DataSourceIsEmpty(ds.Tables[tableName]) || !DataHelper.DataSourceIsEmpty(CompareDataSet.Tables[tableName]))
            {
                if (!excludedTableNames.Contains(";" + tableName.ToLowerCSafe() + ";"))
                {
                    tables.Add(GetString("ObjectType." + tableName), tableName);
                }
            }
        }

        // Generate the tables
        foreach (string tableName in tables.Values)
        {
            DataTable dt        = ds.Tables[tableName].Copy();
            DataTable dtCompare = CompareDataSet.Tables[tableName].Copy();

            if (dt.PrimaryKey.Length <= 0)
            {
                continue;
            }

            // Add table heading
            if ((tables.Count > 1) || (ds.Tables.Count > 1))
            {
                AddTableHeaderRow(Table, GetTableHeaderText(dt), null);
            }

            while (dt.Rows.Count > 0 || dtCompare.Rows.Count > 0)
            {
                // Add table header row
                TableCell labelCell = new TableHeaderCell();
                labelCell.Text = GetString("General.FieldName");
                TableCell valueCell = new TableHeaderCell();
                valueCell.Text = GetString("General.Value");
                TableCell valueCompare = new TableHeaderCell();
                valueCompare.Text = GetString("General.Value");

                AddRow(Table, labelCell, valueCell, valueCompare, "unigrid-head", true);

                DataRow srcDr;
                DataRow dstDr;

                if ((tables.Count == 1) && (dt.Rows.Count == 1) && (dtCompare.Rows.Count == 1))
                {
                    srcDr = dt.Rows[0];
                    dstDr = dtCompare.Rows[0];
                }
                else
                {
                    if (!DataHelper.DataSourceIsEmpty(dt))
                    {
                        srcDr = dt.Rows[0];
                        dstDr = dtCompare.Rows.Find(GetPrimaryColumnsValue(dt, srcDr));
                    }
                    else
                    {
                        dstDr = dtCompare.Rows[0];
                        srcDr = dt.Rows.Find(GetPrimaryColumnsValue(dtCompare, dstDr));
                    }

                    // If match not find, try to find in guid column
                    if ((srcDr == null) || (dstDr == null))
                    {
                        DataTable dtToSearch;
                        DataRow   drTocheck;

                        if (srcDr == null)
                        {
                            dtToSearch = dt;
                            drTocheck  = dstDr;
                        }
                        else
                        {
                            dtToSearch = dtCompare;
                            drTocheck  = srcDr;
                        }


                        GeneralizedInfo infoObj = ModuleManager.GetObject(drTocheck, dt.TableName.Replace("_", "."));
                        if ((infoObj != null) && ((infoObj.CodeNameColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN) || (infoObj.TypeInfo.GUIDColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN)))
                        {
                            DataRow[] rows = dtToSearch.Select(infoObj.CodeNameColumn + "='" + drTocheck[infoObj.CodeNameColumn] + "'");
                            if (rows.Length > 0)
                            {
                                if (srcDr == null)
                                {
                                    srcDr = rows[0];
                                }
                                else
                                {
                                    dstDr = rows[0];
                                }
                            }
                            else
                            {
                                rows = dtToSearch.Select(infoObj.TypeInfo.GUIDColumn + "='" + drTocheck[infoObj.TypeInfo.GUIDColumn] + "'");
                                if (rows.Length > 0)
                                {
                                    if (srcDr == null)
                                    {
                                        srcDr = rows[0];
                                    }
                                    else
                                    {
                                        dstDr = rows[0];
                                    }
                                }
                            }
                        }
                    }
                }

                // Add values
                foreach (DataColumn dc in dt.Columns)
                {
                    // Get content values
                    string fieldContent        = GetRowColumnContent(srcDr, dc, true);
                    string fieldCompareContent = GetRowColumnContent(dstDr, dc, true);

                    if (ShowAllFields || !String.IsNullOrEmpty(fieldContent) || !String.IsNullOrEmpty(fieldCompareContent))
                    {
                        // Initialize comparators
                        TextComparison comparefirst = new TextComparison();
                        comparefirst.SynchronizedScrolling = false;
                        comparefirst.ComparisonMode        = TextComparisonModeEnum.PlainTextWithoutFormating;
                        comparefirst.EnsureHTMLLineEndings = true;

                        TextComparison comparesecond = new TextComparison();
                        comparesecond.SynchronizedScrolling = false;
                        comparesecond.RenderingMode         = TextComparisonTypeEnum.DestinationText;
                        comparesecond.EnsureHTMLLineEndings = true;

                        comparefirst.PairedControl = comparesecond;

                        // Set comparator content
                        comparefirst.SourceText      = fieldContent;
                        comparefirst.DestinationText = fieldCompareContent;

                        // Create set of cells
                        labelCell      = new TableCell();
                        labelCell.Text = "<strong>" + dc.ColumnName + "</strong>";
                        valueCell      = new TableCell();
                        valueCell.Controls.Add(comparefirst);
                        valueCompare = new TableCell();
                        valueCompare.Controls.Add(comparesecond);

                        // Add comparison row
                        AddRow(Table, labelCell, valueCell, valueCompare);
                    }
                }

                // Remove rows from tables
                if (srcDr != null)
                {
                    dt.Rows.Remove(srcDr);
                }
                if (dstDr != null)
                {
                    dtCompare.Rows.Remove(dstDr);
                }

                if (dt.Rows.Count > 0 || dtCompare.Rows.Count > 0)
                {
                    TableCell emptyCell = new TableCell();
                    emptyCell.Text = "&nbsp;";
                    AddRow(Table, emptyCell, null, null, "TableSeparator");
                }
            }
        }
        plcContent.Controls.Add(Table);
    }
コード例 #16
0
    /* This method gets triggered when invoke button is clicked on */
    protected void invokeButton_Click(object sender, EventArgs e)
    {
        if (invokeTypeButtonList.SelectedItem == null)
        {
            errorMessageLabel.Text = "You need to select an invocation type to proceed.";
            return;
        }

        if (invokeTypeButtonList.SelectedItem.Value == "SingleInvoke")
        {
            groupInvokeParametersLabel.Text            = "";
            groupInvokeParametersInstructionLabel.Text = "";
            groupInvokeParametersInputLabel.Text       = "";
            groupInvokeParametersOutputLabel.Text      = "";
            groupInvokeParametersHintLabel.Text        = "";
            groupInvokeList.DataSource = null;
            groupInvokeList.DataBind();
            groupInvokeResultsLabel.Text = "";
            groupInvokeResultsPanel.Controls.Clear();

            List <string> parameters = new List <string>();

            /* Traverse through all the parameterValues and add them to a list */
            foreach (DataListItem item in parameterValueDataList.Items)
            {
                string parameterValue = ((TextBox)item.FindControl("parameterValue")).Text;

                /* If you find that the parameter value is empty, return */
                if (parameterValue == "")
                {
                    errorMessageLabel.Text = "You need to enter all the input parameters to invoke an operation";
                    return;
                }

                parameters.Add(parameterValue);
            }

            string url = serviceUrlTextBox.Text;

            wsdlUtilsService.WSDLServiceClient wsdlUtilsClient =
                new wsdlUtilsService.WSDLServiceClient();

            try
            {
                /* Invoke the web service method */
                wsdlUtilsService.ReturnData returnData =
                    wsdlUtilsClient.InvokeWebServiceMethod(url, parametersLabel.Text,
                                                           parameters.ToArray());

                /* If return data is null, return */
                if (returnData == null)
                {
                    errorMessageLabel.Text = "The invocation didn't yield any result.";
                    return;
                }

                /* Display the result */
                TextBox resultXmlTextBox = new TextBox();
                resultXmlTextBox.Text     = returnData.objectXML;
                resultXmlTextBox.Rows     = 15;
                resultXmlTextBox.Columns  = 70;
                resultXmlTextBox.TextMode = TextBoxMode.MultiLine;

                resultsLabel.Text = "Results";
                resultsPanel.Controls.Add(resultXmlTextBox);
            }
            catch (Exception ec)
            {
                errorMessageLabel.Text = "Invocation didn't succeed. Try again later.";
            }
        }
        else
        {
            parametersLabel.Text = "";
            parameterValueDataList.DataSource = null;
            parameterValueDataList.DataBind();
            resultsLabel.Text = "";
            resultsPanel.Controls.Clear();

            List <string> inputParameters  = new List <string>();
            List <string> outputParameters = new List <string>();

            foreach (DataListItem item in groupInvokeList.Items)
            {
                DataList inputParameterDataList  = (DataList)item.FindControl("groupInvokeInputParameterList");
                DataList outputParameterDataList = (DataList)item.FindControl("groupInvokeOutputParameterList");

                /* Traverse through all the parameterValues and add them to a list */
                foreach (DataListItem inputItem in inputParameterDataList.Items)
                {
                    TextBox textBox             = (TextBox)inputItem.FindControl("groupInvokeInputParameterValue");
                    string  inputParameterValue = ((TextBox)inputItem.FindControl("groupInvokeInputParameterValue")).Text;

                    /* If you find that the parameter value is empty, return */
                    if (inputParameterValue == "")
                    {
                        errorMessageLabel.Text = "You need to enter all the input parameters to invoke an operation";
                        return;
                    }

                    inputParameters.Add(inputParameterValue);
                }

                /* Traverse through all the parameterValues and add them to a list */
                foreach (DataListItem outputItem in outputParameterDataList.Items)
                {
                    TextBox textBox = (TextBox)outputItem.FindControl("groupInvokeOutputParameterValue");
                    string  outputParameterValue = ((TextBox)outputItem.FindControl("groupInvokeOutputParameterValue")).Text;

                    /* If you find that the parameter value is empty, return */
                    if (outputParameterValue == "")
                    {
                        errorMessageLabel.Text = "You need to enter all the output parameters to invoke an operation";
                        return;
                    }

                    outputParameters.Add(outputParameterValue);
                }
            }

            string url = serviceUrlTextBox.Text;

            wsdlUtilsService.WSDLServiceClient wsdlUtilsClient =
                new wsdlUtilsService.WSDLServiceClient();

            try
            {
                /* Invoke the web service method */
                wsdlUtilsService.InvokeResult invokeResult =
                    wsdlUtilsClient.InvokeWebServiceOperationsGroup(url, inputParameters.ToArray(),
                                                                    outputParameters.ToArray());

                /* If return data is null, return */
                if (invokeResult == null)
                {
                    errorMessageLabel.Text = "The invocation didn't yield any result.";
                    return;
                }

                Table           resultsTable  = new Table();
                TableHeaderRow  resultsHeader = new TableHeaderRow();
                TableHeaderCell methodHeader  = new TableHeaderCell();
                methodHeader.Text = "Method Name";
                TableHeaderCell statusHeader = new TableHeaderCell();
                statusHeader.Text = "Invoke Status";
                resultsHeader.Cells.Add(methodHeader);
                resultsHeader.Cells.Add(statusHeader);
                resultsTable.Rows.Add(resultsHeader);

                for (int i = 0; i < invokeResult.MethodName.Length; i++)
                {
                    TableRow  row        = new TableRow();
                    TableCell methodCell = new TableCell();
                    TableCell statusCell = new TableCell();
                    methodCell.Text = invokeResult.MethodName[i];

                    if (invokeResult.InvokeStatus[i] == true)
                    {
                        statusCell.Text = "Success";
                    }
                    else
                    {
                        statusCell.Text = "Failure";
                    }

                    row.Cells.Add(methodCell);
                    row.Cells.Add(statusCell);
                    resultsTable.Rows.Add(row);
                }

                groupInvokeResultsPanel.Controls.Add(resultsTable);
                groupInvokeResultsLabel.Text = "Results";
            }
            catch (Exception ec)
            {
                errorMessageLabel.Text = "Invocation didn't succeed. Try again later.";
            }
        }
    }
コード例 #17
0
    private void CarregaTableAvaliar(int codGrupo, DataSet dsCriteriosPesos)
    {
        string[] codAlunos  = Grupo_Aluno_DB.SelectAllMatriculaByGrupo(codGrupo);
        string[] nomeAlunos = Funcoes.NomeAlunosByMatricula(codAlunos);
        Session["matriculasAlunos"] = codAlunos;

        DataTable dt = new DataTable();
        DataRow   dr = dt.NewRow();


        dt.Columns.Add(" ", typeof(string)); //ADICIONA UMA COLUNA DO CABEÇALHO VAZIA

        //ADICIONA AS COLUNAS DO CABEÇALHO COM OS "IDs" DE ACORDO COM O NOME DO ALUNO
        for (int i = 0; i < nomeAlunos.Length; i++)
        {
            dt.Columns.Add(Funcoes.SplitNomes((i + 1) + nomeAlunos[i].ToString()), typeof(string));
        }

        string pesos = "";

        for (int j = 0; j < dsCriteriosPesos.Tables[0].Rows.Count; j++)
        {
            dr = dt.NewRow();
            for (int i = 0; i < nomeAlunos.Length + 1; i++)
            {
                if (i == 0) //COLUNA FOR IGUAL A 0
                {
                    pesos  += dsCriteriosPesos.Tables[0].Rows[j]["cpi_peso"].ToString() + "|";
                    dr[" "] = dsCriteriosPesos.Tables[0].Rows[j]["cge_nome"].ToString() + " (" + dsCriteriosPesos.Tables[0].Rows[j]["cpi_peso"].ToString() + ")";
                }
            }
            dt.Rows.Add(dr);
        }

        valorPeso.Value = pesos.ToString(); //VARIAVEL USADO PARA CALCULAR MÉDIA NO SCRIPT

        Table   table = new Table();
        TextBox txbNotas;
        Label   lblCriterios;

        table.ID           = "tableAvaliar";
        table.ClientIDMode = System.Web.UI.ClientIDMode.Static;
        table.CssClass     = "gridViewAvaliar";
        panelAvaliar.Controls.Add(table);

        int rowsCount = dt.Rows.Count;
        int colsCount = dt.Columns.Count;

        Session["rowsCount"] = rowsCount;
        Session["colsCount"] = colsCount;

        TableHeaderRow  thr          = new TableHeaderRow();
        TableHeaderCell th           = new TableHeaderCell();
        Label           lblCabecalho = new Label();

        th.Text = " ";
        th.Style.Add("background-color", "#FFF");
        th.Style.Add("border", "transparent");
        thr.Cells.Add(th);

        for (int i = 0; i < nomeAlunos.Length; i++)
        {
            th                   = new TableHeaderCell();
            lblCabecalho         = new Label();
            lblCabecalho.Text    = Funcoes.SplitNomes(nomeAlunos[i].ToString());
            lblCabecalho.ToolTip = nomeAlunos[i].ToString();
            lblCabecalho.Attributes["data-toggle"] = "tooltip";

            th.Style.Add("text-align", "center");
            th.Controls.Add(lblCabecalho);
            thr.Cells.Add(th);
        }

        table.Rows.Add(thr);

        for (int rowIndex = 0; rowIndex < rowsCount; rowIndex++)
        {
            TableRow row = new TableRow();
            row.ID = rowIndex.ToString(); //PARA O ZEBRADO

            for (int colIndex = 0; colIndex < colsCount; colIndex++)
            {
                TableCell cell = new TableCell();

                if (colIndex == 0)
                {
                    lblCriterios              = new Label();
                    lblCriterios.ID           = "lblCriteriosRow_" + rowIndex + "_Col_" + colIndex;
                    lblCriterios.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                    lblCriterios.Text         = dt.Rows[rowIndex][colIndex].ToString();
                    cell.Controls.Add(lblCriterios);
                }
                else
                {
                    txbNotas              = new TextBox();
                    txbNotas.ID           = "txtNotasRow_" + (rowIndex) + "_Col_" + colIndex;
                    txbNotas.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                    txbNotas.CssClass     = "text";
                    txbNotas.MaxLength    = 3;
                    //txbNotas.Attributes["type"] = "Number";
                    txbNotas.Attributes["min"]     = "0";
                    txbNotas.Attributes["max"]     = "10";
                    txbNotas.Attributes["onkeyup"] = "funcaoImpedirValorAvaliar(this.id);";
                    txbNotas.Attributes["onblur"]  = "funcaoAtualizarMedia(this.id);";
                    cell.Style.Add("text-align", "center");
                    txbNotas.Text = dt.Rows[rowIndex][colIndex].ToString();

                    RequiredFieldValidator rfvTxb = new RequiredFieldValidator();
                    rfvTxb.ID = "rfvTxb" + rowIndex + "_Col_" + colIndex;
                    rfvTxb.ControlToValidate  = "txtNotasRow_" + rowIndex + "_Col_" + colIndex;
                    rfvTxb.EnableClientScript = true;
                    rfvTxb.ErrorMessage       = " *";
                    rfvTxb.ForeColor          = System.Drawing.Color.Red;

                    RangeValidator ranTxb = new RangeValidator();
                    ranTxb.ID = "ranTxb" + rowIndex + "_Col_" + colIndex;
                    ranTxb.ControlToValidate = "txtNotasRow_" + rowIndex + "_Col_" + colIndex;
                    ranTxb.MinimumValue      = "0";
                    ranTxb.MaximumValue      = "10";
                    ranTxb.Type = ValidationDataType.Double;
                    ranTxb.EnableClientScript = true;
                    ranTxb.ErrorMessage       = " *";
                    ranTxb.ForeColor          = System.Drawing.Color.Red;

                    cell.Controls.Add(txbNotas);
                    cell.Controls.Add(rfvTxb);
                    cell.Controls.Add(ranTxb);
                }
                row.Cells.Add(cell);
            }
            table.Rows.Add(row);
        }

        TableRow rowMedia = new TableRow();
        Label    lblMedia = new Label();

        for (int colIndex = 0; colIndex < colsCount; colIndex++)
        {
            TableCell cell = new TableCell();
            cell.CssClass         = "mediaAvaliar";
            lblMedia              = new Label();
            lblMedia.ID           = "lblMediaRow_" + table.Rows.Count + "_Col_" + colIndex;
            lblMedia.ClientIDMode = System.Web.UI.ClientIDMode.Static;

            if (colIndex == 0)
            {
                lblMedia.Text = "Média Ponderada Individual: ";
            }
            else
            {
                lblMedia.Text = " ";
            }
            cell.Controls.Add(lblMedia);
            rowMedia.Cells.Add(cell);
        }
        table.Rows.Add(rowMedia);

        ScriptManager.RegisterStartupScript(this, this.GetType(), "ZebradoGridAvaliar", "ZebradoGridAvaliar();", true);
    }
コード例 #18
0
        private void crearTabla(int cantTrab, int cantGest)
        {
            Table _table;

            #region variables
            _table          = new Table();
            _table.ID       = "tbCapacitacion";
            _table.CssClass = "table";
            TableHeaderRow _header_fila = new TableHeaderRow();
            #endregion

            #region cabecera tabla
            #region  Nro
            TableHeaderCell _header_celda = new TableHeaderCell();
            _header_celda.Text     = "Nro";
            _header_celda.CssClass = "text-center";
            _header_fila.Cells.Add(_header_celda);
            _table.Rows.Add(_header_fila);
            #endregion

            #region Trabajador
            _header_celda          = new TableHeaderCell();
            _header_celda.Text     = "NOMBRE";
            _header_celda.CssClass = "text-center";
            _header_fila.Cells.Add(_header_celda);
            _table.Rows.Add(_header_fila);
            #endregion

            #region Cedula
            _header_celda          = new TableHeaderCell();
            _header_celda.Text     = "DOCUMENTO DE IDENTIDAD";
            _header_celda.CssClass = "text-center";
            _header_fila.Cells.Add(_header_celda);
            _table.Rows.Add(_header_fila);
            #endregion

            #region cantidad Horas
            _header_celda          = new TableHeaderCell();
            _header_celda.Text     = "CANTIDAD HORAS ACUMULADAS";
            _header_celda.CssClass = "text-center";
            _header_fila.Cells.Add(_header_celda);
            _table.Rows.Add(_header_fila);
            #endregion

            Tuple <int, int> IdEmpSuc = Mgr_Empresa.Get_IdEmpresa_IdSucursal(ObjUsuario, ddlEmpresa, ddlSucursal);
            IdEmpresa  = IdEmpSuc.Item1;
            IdSucursal = IdEmpSuc.Item2;

            List <gestion_laboral> gestion_lista = new List <gestion_laboral>();
            gestion_lista = Mgr_GestionLaboral.Get_GestionLaboralByCapacitacion(fechaInicial, fechaFinal, IdEmpresa, IdSucursal);

            foreach (gestion_laboral gl in gestion_lista)
            {
                #region  Temas
                _header_celda = new TableHeaderCell();
                string titulo = gl.descripcion + " <br/> " + Convert.ToDateTime(gl.fecha).ToString("dd-MM-yyy") + " Horas:" + gl.cant_horas;
                _header_celda.Text     = titulo.ToUpperInvariant();
                _header_celda.CssClass = "text-center";
                _header_fila.Cells.Add(_header_celda);
                _table.Rows.Add(_header_fila);
                #endregion
            }

            #endregion

            TableCell _fila = new TableCell();
            TableRow  _columna = new TableRow();
            int       NumTrab = 1, gestion = 1, HorasAsistio = 0, inaJust = 0, InaInjust = 0, Asistencias = 0;
            bool      CantHoras = false;

            List <trabajador> List_Trab = Mgr_Trabajador.Get_Trabajador(0, 0, Convert.ToInt32(IdSucursal), 0);

            foreach (var item1 in List_Trab)
            {
                HorasAsistio = 0;
                CantHoras    = false;

                List <trabajador_gestion> trab_lista = Mgr_Trabajador.Get_TrabajadoresByCapacitacion(item1.id_trabajador, fechaInicial, fechaFinal);

                foreach (var item2 in trab_lista)
                {
                    if (HorasAsistio == 0)
                    {
                        #region datos trabajador
                        _columna    = new TableRow();
                        _columna.ID = "columna" + NumTrab;
                        _fila       = new TableCell();
                        _fila.Text  = "" + (NumTrab);
                        _columna.Cells.Add(_fila);
                        _table.Rows.Add(_columna);

                        _fila      = new TableCell();
                        _fila.Text = string.Empty + (item1.primer_nombre + ' ' + item1.primer_apellido);
                        _fila.Attributes.Add("style", "white-space: nowrap;");
                        _columna.Cells.Add(_fila);
                        _table.Rows.Add(_columna);

                        _fila      = new TableCell();
                        _fila.Text = string.Empty + (item1.cedula);
                        _columna.Cells.Add(_fila);
                        _table.Rows.Add(_columna);
                        #endregion
                    }

                    #region asistencias
                    _fila    = new TableCell();
                    _fila.ID = "fila" + gestion + "_" + NumTrab;
                    if (item2.asistencia.Contains("SI"))
                    {
                        _fila.Text      = "Asistió";
                        HorasAsistio    = HorasAsistio + Convert.ToInt32(item2.gestion_laboral.cant_horas);
                        _fila.BackColor = System.Drawing.Color.MediumPurple;
                        Asistencias++;
                    }
                    else if (item2.asistencia.Contains("-"))
                    {
                        _fila.Text      = "Sin Asistencia";
                        _fila.BackColor = System.Drawing.Color.YellowGreen;
                    }
                    else
                    {
                        if (item2.asistencia.Contains("Justificada"))
                        {
                            _fila.Text      = "No Asistió";
                            _fila.BackColor = System.Drawing.Color.SkyBlue;
                            inaJust++;
                        }
                        else if (item2.asistencia.Contains("Injustificada"))
                        {
                            _fila.Text      = "No Asistió";
                            _fila.BackColor = System.Drawing.Color.Tomato;
                            InaInjust++;
                        }
                    }
                    #endregion

                    _fila.CssClass = "text-center";
                    _columna.Cells.Add(_fila);
                    gestion++;
                    CantHoras = true;
                }

                if (CantHoras)
                {
                    _table.Rows.Add(_columna);
                    _fila           = new TableCell();
                    _fila.Text      = "" + HorasAsistio;
                    _fila.CssClass  = "text-center";
                    _fila.BackColor = System.Drawing.Color.DarkSeaGreen;
                    _columna.Cells.AddAt(3, _fila);
                    _table.Rows.Add(_columna);

                    NumTrab++;
                    pnTablaCapacitacion.Controls.Add(_table);
                }
            }

            #region  Generar la grafica
            int totalIna = inaJust + InaInjust;
            lblTotalInasistencias.Text = totalIna.ToString();
            lblTotalAsistencias.Text   = "" + Asistencias;
            Double[] yAsistencias = { 0, 0 };
            yAsistencias[0] = totalIna;
            yAsistencias[1] = Asistencias;
            String[] xCadenas = { "Inasistencia", "Asistencia" };
            graficoAsistencia.Series["asistencias"].Label = "#PERCENT{P0}";
            graficoAsistencia.Series["asistencias"].Points.DataBindXY(xCadenas, yAsistencias);
            #endregion
        }
コード例 #19
0
        private void fillStatisticTable()
        {
            IList <TblUsers> ilistusers;

            ilistusers = TeacherHelper.GetStudentsOfGroup(group);
            if (UserId > 0)
            {
                user = ServerModel.DB.Load <TblUsers>(UserId);
                ilistusers.Clear();
                ilistusers.Add(user);
            }
            StatisticTable.Rows.Clear();

            TableHeaderRow headerRow = new TableHeaderRow();

            TableHeaderCell headerCell = new TableHeaderCell();

            headerCell.Text = studentStr;
            headerRow.Cells.Add(headerCell);

            foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
            {
                foreach (TblThemes theme in TeacherHelper.ThemesOfStage(stage))
                {
                    headerCell      = new TableHeaderCell();
                    headerCell.Text = theme.Name;
                    headerRow.Cells.Add(headerCell);
                }
            }
            headerCell      = new TableHeaderCell();
            headerCell.Text = totalStr;
            headerRow.Cells.Add(headerCell);

            headerCell      = new TableHeaderCell();
            headerCell.Text = Translations.StatisticShowController_fillStatisticTable_Percent;
            headerRow.Cells.Add(headerCell);

            headerCell      = new TableHeaderCell();
            headerCell.Text = "ECTS";
            headerRow.Cells.Add(headerCell);

            StatisticTable.Rows.Add(headerRow);
            foreach (TblUsers student in ilistusers)
            {
                var       studentRow  = new TableRow();
                TableCell studentCell = new TableHeaderCell {
                    HorizontalAlign = HorizontalAlign.Center
                };
                studentCell.Controls.Add(new HyperLink
                {
                    Text        = student.DisplayName,
                    NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new StatisticShowGraphController
                    {
                        GroupID      = GroupID,
                        CurriculumID = curriculum.ID,
                        UserId       = student.ID,
                        BackUrl      = RawUrl
                    })
                });


                studentRow.Cells.Add(studentCell);

                double pasedCurriculum = 0;
                double totalCurriculum = 0;
                foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
                {
                    foreach (TblThemes theme in TeacherHelper.ThemesOfStage(stage))
                    {
                        double           result       = 0;
                        double           totalresult  = 0;
                        int              learnercount = TeacherHelper.GetLastIndexOfAttempts(student.ID, theme.ID);
                        TblOrganizations organization;
                        organization = ServerModel.DB.Load <TblOrganizations>(theme.OrganizationRef);
                        foreach (TblItems items in TeacherHelper.ItemsOfOrganization(organization))
                        {
                            totalresult += Convert.ToDouble(items.Rank);
                        }

                        foreach (TblLearnerAttempts attempt in TeacherHelper.AttemptsOfTheme(theme))
                        {
                            if (attempt.ID == TeacherHelper.GetLastLearnerAttempt(student.ID, theme.ID))
                            {
                                foreach (TblLearnerSessions session in TeacherHelper.SessionsOfAttempt(attempt))
                                {
                                    CmiDataModel cmiDataModel = new CmiDataModel(session.ID, student.ID, false);
                                    List <TblVarsInteractions> interactionsCollection = cmiDataModel.GetCollection <TblVarsInteractions>("interactions.*.*");

                                    for (int i = 0, j = 0; i < int.Parse(cmiDataModel.GetValue("interactions._count")); i++)
                                    {
                                        for (; j < interactionsCollection.Count && i == interactionsCollection[j].Number; j++)
                                        {
                                            if (interactionsCollection[j].Name == "result")
                                            {
                                                TblItems itm = ServerModel.DB.Load <TblItems>(session.ItemRef);
                                                if (interactionsCollection[j].Value == "correct")
                                                {
                                                    result += Convert.ToDouble(itm.Rank);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }



                        string attmpt = "";
                        if (learnercount > 0)
                        {
                            attmpt = "(" + learnercount.ToString() + " attempt )";
                        }
                        else if (learnercount == 0)
                        {
                            attmpt = "";
                        }

                        studentCell = new TableCell {
                            HorizontalAlign = HorizontalAlign.Center
                        };
                        studentCell.Controls.Add(new HyperLink
                        {
                            Text        = result + "/" + totalresult + attmpt,
                            NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new ThemeResultController
                            {
                                BackUrl          = string.Empty,
                                LearnerAttemptId = TeacherHelper.GetLastLearnerAttempt(student.ID, theme.ID),
                            })
                        });

                        if (learnercount == 0)
                        {
                            studentCell.Enabled   = false;
                            studentCell.BackColor = Color.Yellow;
                        }
                        else if (learnercount > 0)
                        {
                            studentCell.BackColor = Color.YellowGreen;
                        }

                        pasedCurriculum += result;
                        totalCurriculum += totalresult;
                        studentRow.Cells.Add(studentCell);
                    }
                }

                studentCell = new TableCell
                {
                    HorizontalAlign = HorizontalAlign.Center,
                    Text            = pasedCurriculum + "/" + totalCurriculum
                };
                studentRow.Cells.Add(studentCell);
                studentCell = new TableCell {
                    HorizontalAlign = HorizontalAlign.Center
                };
                double temp_total;
                if (totalCurriculum != 0)
                {
                    temp_total = pasedCurriculum / totalCurriculum * 100;
                }
                else
                {
                    temp_total = 0;
                }
                studentCell.Text = (temp_total).ToString("F2");
                studentRow.Cells.Add(studentCell);
                studentCell = new TableCell {
                    HorizontalAlign = HorizontalAlign.Center
                };
                studentCell.Text = TeacherHelper.ECTS_code(temp_total);

                studentRow.Cells.Add(studentCell);
                StatisticTable.Rows.Add(studentRow);
            }

            if (StatisticTable.Rows.Count == 1)
            {
                StatisticTable.Visible = false;
                Message.Value          = noStudents;
            }
        }
コード例 #20
0
    /// <summary>
    /// Gets new table header cell which contains label and rollback image.
    /// </summary>
    /// <param name="suffixID">ID suffix</param>
    /// <param name="documentID">Document ID</param>
    /// <param name="versionID">Version history ID</param>
    /// <param name="action">Action</param>
    private TableHeaderCell GetRollbackTableHeaderCell(string suffixID, ObjectVersionHistoryInfo objectVersion)
    {
        TableHeaderCell tblHeaderCell = new TableHeaderCell();

        // Label
        Label lblValue = new Label();

        lblValue.ID   = "lbl" + suffixID;
        lblValue.Text = HTMLHelper.HTMLEncode(GetVersionNumber(objectVersion.VersionNumber, objectVersion.VersionModifiedWhen));

        // Panel
        Panel pnlLabel = new Panel();

        pnlLabel.ID       = "pnlLabel" + suffixID;
        pnlLabel.CssClass = "LeftAlign";
        pnlLabel.Controls.Add(lblValue);

        tblHeaderCell.Controls.Add(pnlLabel);

        // Add rollback controls if user authorized to modify selected object
        if (UserInfoProvider.IsAuthorizedPerObject(objectVersion.VersionObjectType, PermissionsEnum.Modify, CMSContext.CurrentSiteName, CMSContext.CurrentUser))
        {
            // Rollback panel
            Panel pnlImage = new Panel();
            pnlImage.ID       = "pnlRollback" + suffixID;
            pnlImage.CssClass = "RightAlign";

            // Rollback image
            Image imgRollback = new Image();
            imgRollback.ID = "imgRollback" + suffixID;

            string tooltip     = null;
            string confirmText = null;

            // Set image action and description according to roll back type
            if (chkDisplayAllData.Checked)
            {
                tooltip              = GetString("objectversioning.versionlist.versionfullrollbacktooltip");
                confirmText          = GetString("objectversioning.versionlist.confirmfullrollback");
                imgRollback.ImageUrl = GetImageUrl(IsCheckedOutByCurrentUser ? "CMSModules/CMS_RecycleBin/restorechilds.png" : "CMSModules/CMS_RecycleBin/restorechildsdisabled.png");
            }
            else
            {
                tooltip              = GetString("history.versionrollbacktooltip");
                confirmText          = GetString("Unigrid.ObjectVersionHistory.Actions.Rollback.Confirmation");
                imgRollback.ImageUrl = GetImageUrl(IsCheckedOutByCurrentUser ? "Design/Controls/UniGrid/Actions/undo.png" : "Design/Controls/UniGrid/Actions/undodisabled.png");
            }

            imgRollback.AlternateText = tooltip;
            imgRollback.ToolTip       = tooltip;
            imgRollback.Style.Add("cursor", "pointer");

            // Prepare onclick script
            if (IsCheckedOutByCurrentUser)
            {
                var confirmScript = "if (confirm(\"" + confirmText + "\")) { ";
                confirmScript += ControlsHelper.GetPostBackEventReference(this, objectVersion.VersionID + "|" + chkDisplayAllData.Checked) + "; return false; }";
                imgRollback.Attributes.Add("onclick", confirmScript);
            }

            pnlImage.Controls.Add(imgRollback);
            tblHeaderCell.Controls.Add(pnlImage);
        }

        return(tblHeaderCell);
    }
コード例 #21
0
    /// <summary>
    /// Generates the permission matrix for the current library.
    /// </summary>
    private void CreateMatrix()
    {
        // Get library resource info
        if ((ResLibrary != null) && (LibraryInfo != null))
        {
            // Get permissions for the current library resource
            DataSet permissions = PermissionNameInfoProvider.GetResourcePermissions(ResLibrary.ResourceId);
            if (DataHelper.DataSourceIsEmpty(permissions))
            {
                lblInfo.ResourceString = "general.emptymatrix";
                lblInfo.Visible = true;
            }
            else
            {
                TableRow headerRow = new TableRow();
                headerRow.CssClass = "UniGridHead";
                TableCell newCell = new TableCell();
                TableHeaderCell newHeaderCell = new TableHeaderCell();
                newHeaderCell.Text = "&nbsp;";
                newHeaderCell.CssClass = "MatrixHeader";
                newHeaderCell.Attributes["style"] = "width:28%;";
                headerRow.Cells.Add(newHeaderCell);

                DataView dv = permissions.Tables[0].DefaultView;
                dv.Sort = "PermissionDisplayName ASC";

                // Generate header cells
                foreach (DataRowView drv in dv)
                {
                    string permissionName = drv.Row["PermissionName"].ToString();
                    if (permissionArray.Contains(permissionName.ToLowerCSafe()))
                    {
                        newHeaderCell = new TableHeaderCell();
                        newHeaderCell.CssClass = "MatrixHeader";
                        newHeaderCell.Attributes["style"] = "width:12%;text-align:center;white-space:nowrap;";
                        newHeaderCell.Text = HTMLHelper.HTMLEncode(drv.Row["PermissionDisplayName"].ToString());
                        newHeaderCell.ToolTip = Convert.ToString(drv.Row["PermissionDescription"]);
                        newHeaderCell.HorizontalAlign = HorizontalAlign.Center;

                        headerRow.Cells.Add(newHeaderCell);
                    }
                }

                // Insert the empty cell at the end
                newHeaderCell = new TableHeaderCell();
                newHeaderCell.Text = "&nbsp;";
                headerRow.Cells.Add(newHeaderCell);
                tblMatrix.Rows.Add(headerRow);

                // Render library access permissions
                object[,] accessNames = new object[5,2];
                accessNames[0, 0] = GetString("security.nobody");
                accessNames[0, 1] = SecurityAccessEnum.Nobody;
                accessNames[1, 0] = GetString("security.allusers");
                accessNames[1, 1] = SecurityAccessEnum.AllUsers;
                accessNames[2, 0] = GetString("security.authenticated");
                accessNames[2, 1] = SecurityAccessEnum.AuthenticatedUsers;
                accessNames[3, 0] = GetString("security.groupmembers");
                accessNames[3, 1] = SecurityAccessEnum.GroupMembers;
                accessNames[4, 0] = GetString("security.authorizedroles");
                accessNames[4, 1] = SecurityAccessEnum.AuthorizedRoles;

                TableRow newRow = null;
                int rowIndex = 0;

                for (int access = 0; access <= accessNames.GetUpperBound(0); access++)
                {
                    SecurityAccessEnum currentAccess = ((SecurityAccessEnum)accessNames[access, 1]);
                    // If the security isn't displayed as part of group section
                    if (((currentAccess == SecurityAccessEnum.GroupAdmin) || (currentAccess == SecurityAccessEnum.GroupMembers)) && (!(LibraryInfo.LibraryGroupID > 0)))
                    {
                        // Do not render this access item
                    }
                    else
                    {
                        // Generate cell holding access item name
                        newRow = new TableRow();
                        newRow.CssClass = ((rowIndex % 2 == 0) ? "EvenRow" : "OddRow");
                        newCell = new TableCell();
                        newCell.CssClass = "MatrixHeader";
                        newCell.Text = accessNames[access, 0].ToString();
                        newCell.Wrap = false;
                        newRow.Cells.Add(newCell);
                        rowIndex++;

                        // Render the permissions access items
                        int permissionIndex = 0;
                        for (int permission = 0; permission < (tblMatrix.Rows[0].Cells.Count - 2); permission++)
                        {
                            newCell = new TableCell();
                            newCell.HorizontalAlign = HorizontalAlign.Center;
                            int accessEnum = Convert.ToInt32(accessNames[access, 1]);
                            // Check if the currently processed access is applied for permission
                            bool isAllowed = CheckPermissionAccess(accessEnum, permission, tblMatrix.Rows[0].Cells[permission + 1].Text);

                            // Disable column in roles grid if needed
                            if ((currentAccess == SecurityAccessEnum.AuthorizedRoles) && !isAllowed)
                            {
                                gridMatrix.DisableColumn(permissionIndex);
                            }

                            // Insert the radio button for the current permission
                            string permissionText = tblMatrix.Rows[0].Cells[permission + 1].Text;
                            string elemId = ClientID + "_" + permission + "_" + access;
                            newCell.Text = "<label style=\"display:none;\" for=\"" + elemId + "\">" + permissionText + "</label><input type=\"radio\" id=\"" + elemId + "\" name=\"" + permissionText + "\" " + (Enable ? "" : "disabled=\"disabled\"") + " onclick=\"" + Page.ClientScript.GetPostBackEventReference(this, permission + "|" + accessEnum) + "\" " + ((isAllowed) ? "checked = \"checked\"" : "") + "/>";

                            newCell.Wrap = false;
                            newRow.Cells.Add(newCell);
                            permissionIndex++;
                        }

                        newCell = new TableCell();
                        newCell.Text = "&nbsp;";
                        newRow.Cells.Add(newCell);
                        // Add the access row to the table
                        tblMatrix.Rows.Add(newRow);
                    }
                }

                // Get permission matrix for roles of the current site/group
                mNoRolesAvailable = !gridMatrix.HasData;
                if (!mNoRolesAvailable)
                {
                    // Security - Role separator
                    newRow = new TableRow();
                    newCell = new TableCell();
                    newCell.Text = "&nbsp;";
                    newCell.Attributes.Add("colspan", Convert.ToString(tblMatrix.Rows[0].Cells.Count));
                    newRow.Controls.Add(newCell);
                    tblMatrix.Rows.Add(newRow);

                    // Security - Role separator text
                    newRow = new TableRow();
                    newCell = new TableCell();
                    newCell.CssClass = "MatrixLabel";
                    newCell.Text = GetString("SecurityMatrix.RolesAvailability");
                    newCell.Attributes.Add("colspan", Convert.ToString(tblMatrix.Rows[0].Cells.Count));
                    newRow.Controls.Add(newCell);
                    tblMatrix.Rows.Add(newRow);
                }
            }
        }
    }
コード例 #22
0
ファイル: ViewVersion.ascx.cs プロジェクト: kudutest2/Kentico
    /// <summary>
    /// Reloads control with new data.
    /// </summary>
    private void ReloadData()
    {
        tblDocument.Rows.Clear();

        DataClassInfo ci = DataClassInfoProvider.GetDataClass(Node.NodeClassName);

        if (ci != null)
        {
            fi = FormHelper.GetFormInfo(ci.ClassName, false);

            TableHeaderCell labelCell    = new TableHeaderCell();
            TableHeaderCell valueCell    = null;
            TableHeaderCell valueCompare = null;

            // Add header column with version number
            if (CompareNode == null)
            {
                labelCell.Text            = GetString("General.FieldName");
                labelCell.EnableViewState = false;
                valueCell = new TableHeaderCell();
                valueCell.EnableViewState = false;
                valueCell.Text            = GetString("General.Value");

                // Add table header
                AddRow(labelCell, valueCell, "UniGridHead", false);
            }
            else
            {
                labelCell.Text = GetString("lock.versionnumber");
                valueCell      = GetRollbackTableHeaderCell("source", Node.DocumentID, versionHistoryId);
                valueCompare   = GetRollbackTableHeaderCell("compare", CompareNode.DocumentID, versionCompare);

                // Add table header
                AddRow(labelCell, valueCell, valueCompare, true, "UniGridHead", false);
            }

            if (ci.ClassIsCoupledClass)
            {
                // Add coupled class fields
                IDataClass coupleClass = DataClassFactory.NewDataClass(Node.NodeClassName);
                if (coupleClass != null)
                {
                    foreach (string col in coupleClass.StructureInfo.ColumnNames)
                    {
                        // If comparing with other version and current coupled column is not versioned do not display it
                        if (!((CompareNode != null) && !(VersionManager.IsVersionedCoupledColumn(Node.NodeClassName, col))))
                        {
                            AddField(Node, CompareNode, col);
                        }
                    }
                }
            }

            // Add versioned document class fields
            IDataClass docClass = DataClassFactory.NewDataClass("cms.document");
            if (docClass != null)
            {
                foreach (string col in docClass.StructureInfo.ColumnNames)
                {
                    // If comparing with other version and current document column is not versioned do not display it
                    // One exception is DocumentNamePath column which will be displayed even if it is not marked as a versioned column
                    if (!((CompareNode != null) && (!(VersionManager.IsVersionedDocumentColumn(col) || (col.ToLower() == "documentnamepath")))))
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add versioned document class fields
            IDataClass treeClass = DataClassFactory.NewDataClass("cms.tree");
            if (treeClass != null)
            {
                foreach (string col in treeClass.StructureInfo.ColumnNames)
                {
                    // Do not display cms_tree columns when comparing with other version
                    // cms_tree columns are not versioned
                    if (CompareNode == null)
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add unsorted attachments to the table
            AddField(Node, CompareNode, UNSORTED);
        }
    }
コード例 #23
0
ファイル: ViewVersion.ascx.cs プロジェクト: kudutest2/Kentico
    /// <summary>
    /// Gets new table header cell which contains label and rollback image.
    /// </summary>
    /// <param name="suffixID">ID suffix</param>
    /// <param name="documentID">Document ID</param>
    /// <param name="versionID">Version history ID</param>
    /// <param name="action">Action</param>
    private TableHeaderCell GetRollbackTableHeaderCell(string suffixID, int documentID, int versionID)
    {
        TableHeaderCell tblHeaderCell = new TableHeaderCell();

        tblHeaderCell.EnableViewState = false;

        string tooltip = GetString("history.versionrollbacktooltip");

        // Label
        Label lblValue = new Label();

        lblValue.ID              = "lbl" + suffixID;
        lblValue.Text            = HTMLHelper.HTMLEncode(GetVersionNumber(documentID, versionID));
        lblValue.EnableViewState = false;

        // Panel
        Panel pnlLabel = new Panel();

        pnlLabel.ID       = "pnlLabel" + suffixID;
        pnlLabel.CssClass = "LeftAlign";
        pnlLabel.Controls.Add(lblValue);
        pnlLabel.EnableViewState = false;

        // Rollback image
        Image imgRollback = new Image();

        imgRollback.ID              = "imgRollback" + suffixID;
        imgRollback.AlternateText   = tooltip;
        imgRollback.ToolTip         = tooltip;
        imgRollback.EnableViewState = false;

        // Disable buttons according to permissions
        if (!CanApprove || !CanModify || (CheckedOutByAnotherUser && !CanCheckIn))
        {
            imgRollback.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/undodisabled.png");
            imgRollback.Enabled  = false;
        }
        else
        {
            imgRollback.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/undo.png");
            imgRollback.Style.Add("cursor", "pointer");
        }

        // Prepare onclick script
        string confirmScript = "if (confirm(" + ScriptHelper.GetString(GetString("Unigrid.VersionHistory.Actions.Rollback.Confirmation")) + ")) { ";

        confirmScript += Page.ClientScript.GetPostBackEventReference(this, versionID.ToString()) + "; return false; }";
        imgRollback.Attributes.Add("onclick", confirmScript);

        // Rollback panel
        Panel pnlImage = new Panel();

        pnlImage.EnableViewState = false;
        pnlImage.ID       = "pnlRollback" + suffixID;
        pnlImage.CssClass = "RightAlign";
        pnlImage.Controls.Add(imgRollback);

        tblHeaderCell.Controls.Add(pnlLabel);
        tblHeaderCell.Controls.Add(pnlImage);

        return(tblHeaderCell);
    }
コード例 #24
0
    private void GenerateTable(string studentID)
    {
        string ID = studentID;

        DataTable dt = CreateDataTable1(ID);
        //DataTable dt2 = CreatDataTable2();
        //DataTable dtBoth = myJoinMethod(dt, dt2, "EvalResponseID", "CourseID");

        //System.Diagnostics.Debug.WriteLine(dt.Rows[0][0].ToString());
        //System.Diagnostics.Debug.WriteLine(dt.Rows[0][1].ToString());
        //System.Diagnostics.Debug.WriteLine(dt.Rows[0][2].ToString());
        //System.Diagnostics.Debug.WriteLine(dt.Rows[0][3].ToString());
        //System.Diagnostics.Debug.WriteLine(dt.Rows[0][4].ToString());



        Table    table = new Table();
        GridView grid  = new GridView();
        TableRow row   = null;

        table.CellSpacing = 20;
        table.CellPadding = 10;
        table.GridLines   = GridLines.Vertical;

        // Add the Headers
        row = new TableRow();
        TableHeaderCell course = new TableHeaderCell();

        course.Text = "Class Name";
        row.Cells.Add(course);
        TableHeaderCell viewEval = new TableHeaderCell();

        viewEval.Text = "View Evaluation";
        row.Cells.Add(viewEval);
        table.Rows.Add(row);
        // determine which datatable has more rows so for loop captures everything
        int rowCount = dt.Rows.Count;

        System.Diagnostics.Debug.WriteLine(rowCount);
        for (int i = 0; i < rowCount; i++)
        {
            System.Diagnostics.Debug.WriteLine(dt.Rows[i][1].ToString());
            System.Diagnostics.Debug.WriteLine(dt.Rows[i][4].ToString());

            // Row containing the class names that the studentID passed in has taken (EvaluateeEmail to see how many evaluations have been filled out ABOUT a student)
            row = new TableRow();
            TableCell courseName = new TableCell();
            courseName.Text = dt.Rows[i][0].ToString();
            row.Cells.Add(courseName);

            TableCell  eval     = new TableCell();
            LinkButton evalLink = new LinkButton();
            evalLink.Text            = "View This Evaluation";
            evalLink.Click          += evalLink_Click;
            evalLink.CommandArgument = dt.Rows[i][5].ToString();
            eval.Controls.Add(evalLink);
            row.Cells.Add(eval);
            table.Rows.Add(row);
        }
        form1.Controls.Add(table);
    }
コード例 #25
0
        protected void BindAllSubject(bool initial)
        {
            BLL.CCOM.Subject bll = new BLL.CCOM.Subject();
            try
            {
                List <Model.CCOM.Subject> subjectList = bll.GetModelList("Major_Agency_id=" + Convert.ToInt32(this.ddlMajor.SelectedItem.Value));
                foreach (Model.CCOM.Subject subject in subjectList)
                {
                    subjectDic.Add(subject.Subject_id, subject);
                }
            }
            catch (Exception e)
            {
                return;
            }
            //添加表头
            TableHeaderRow header = new TableHeaderRow();

            this.subjectTable.Controls.Add(header);
            TableHeaderCell headerCell1 = new TableHeaderCell();

            headerCell1.Text = "标题";
            headerCell1.Attributes.Add("width", "26%");
            header.Cells.Add(headerCell1);
            TableHeaderCell headerCell2 = new TableHeaderCell();

            headerCell2.Text = "值类型";
            headerCell2.Attributes.Add("width", "16%");
            header.Cells.Add(headerCell2);
            TableHeaderCell headerCell3 = new TableHeaderCell();

            headerCell3.Text = "考试方式";
            headerCell3.Attributes.Add("width", "8%");
            header.Cells.Add(headerCell3);
            TableHeaderCell headerCell4 = new TableHeaderCell();

            headerCell4.Text = "管理机构";
            headerCell4.Attributes.Add("width", "14%");
            header.Cells.Add(headerCell4);
            TableHeaderCell headerCell5 = new TableHeaderCell();

            headerCell5.Text = "权值";
            headerCell5.Attributes.Add("width", "8%");
            header.Cells.Add(headerCell5);
            TableHeaderCell headerCell6 = new TableHeaderCell();

            headerCell6.Text = "描述";
            headerCell6.Attributes.Add("width", "16%");
            header.Cells.Add(headerCell6);
            TableHeaderCell headerCell7 = new TableHeaderCell();

            headerCell7.Text = "操作";
            headerCell7.Attributes.Add("width", "12%");
            header.Cells.Add(headerCell7);
            BLL.CCOM.Period pbll     = new BLL.CCOM.Period();
            var             pmodel   = pbll.GetModel("Period_state=1");
            int             periodId = pmodel.Period_id;

            if (this.ddlMajor.SelectedItem.Value == "#")
            {
                this.subjectTable.Controls.Clear();
                return;
            }
            int majorId = Convert.ToInt32(this.ddlMajor.SelectedItem.Value);

            root = bll.GetModel("Major_Agency_id=" + majorId + "and Subject_level=0");
            if (root == null)
            {
                Model.CCOM.Subject model = new Model.CCOM.Subject();
                model.Major_Agency_id = majorId;
                model.Period_id       = periodId;
                model.Fs_id           = 0;
                model.Subject_weight  = 0;
                model.Value_type      = 0;
                model.Subject_level   = 0;
                model.Subject_title   = "";
                int Fsid = bll.Add(model);
                root = bll.GetModel(Fsid);
            }
            BindSubject(root, true, initial, 0);
        }
コード例 #26
0
        //function to retrive questions
        public void GetQuestions()
        {
            DataTable tab = new DataTable();
            BLL       obj = new BLL();

            tab.Rows.Clear();

            if (DropDownListType.SelectedIndex > 0)
            {
                tab = obj.GetQuestionsByType(int.Parse(DropDownListType.SelectedValue));
            }
            else
            {
                tab = obj.GetAllQuestions();
            }

            int serialNo = 1;

            if (tab.Rows.Count > 0)
            {
                tableQA.Rows.Clear();

                for (int cnt = 0; cnt < tab.Rows.Count; cnt++)
                {
                    TableRow row1 = new TableRow();

                    TableCell row1_cell1 = new TableCell();
                    row1_cell1.Font.Size = 10;
                    row1_cell1.Text      = cnt + serialNo + ".";
                    row1.Controls.Add(row1_cell1);

                    TableCell cell_topic = new TableCell();
                    //cell_topic.Width = 750;
                    HyperLink li = new HyperLink();
                    li.ID          = tab.Rows[cnt]["QuestionId"].ToString();
                    li.Text        = tab.Rows[cnt]["Question"].ToString();
                    li.NavigateUrl = string.Format("Answers.aspx?Question={0}&QuestionId={1}", tab.Rows[cnt]["Question"].ToString(), tab.Rows[cnt]["QuestionId"].ToString());
                    cell_topic.Controls.Add(li);
                    row1.Controls.Add(cell_topic);

                    TableRow row2 = new TableRow();

                    TableCell row2Cell1 = new TableCell();
                    row2Cell1.Text = " ";
                    row2.Controls.Add(row2Cell1);

                    TableCell row2Cell2 = new TableCell();
                    row2Cell2.Text = "<br/>";
                    row2.Controls.Add(row2Cell2);

                    TableRow row3 = new TableRow();

                    TableCell row3cell1 = new TableCell();
                    row3cell1.Text = " ";
                    row3.Controls.Add(row3cell1);

                    DataTable tab50 = new DataTable();
                    tab50.Rows.Clear();

                    tab50 = obj.GetMemberById(int.Parse(tab.Rows[cnt]["MemberId"].ToString()));
                    TableCell row3cell2 = new TableCell();
                    row3cell2.Text = "Posted By : " + tab50.Rows[0]["FName"].ToString() + " ," + "Posted Date : " + tab.Rows[cnt]["PostedDate"].ToString() + "<br/>";
                    row3.Controls.Add(row3cell2);

                    TableRow row4 = new TableRow();

                    TableCell row4cell1 = new TableCell();
                    row4cell1.Text = " ";
                    row4.Controls.Add(row4cell1);

                    // if (DropDownListType.SelectedIndex > 0)
                    // {
                    TableCell row10_cell1 = new TableCell();
                    row10_cell1.HorizontalAlign = HorizontalAlign.Right;

                    Button btnDelete = new Button();
                    btnDelete.ID            = "Del~" + tab.Rows[cnt]["QuestionId"].ToString();
                    btnDelete.Text          = "Delete";
                    btnDelete.OnClientClick = "return confirm('Are your sure want to delete?')";
                    btnDelete.Click        += new EventHandler(btnDelete_Click);
                    row10_cell1.Controls.Add(btnDelete);
                    row4.Controls.Add(row10_cell1);
                    // }



                    TableRow row10 = new TableRow();

                    TableCell row10cell1 = new TableCell();
                    row10cell1.ColumnSpan = 10;
                    row10cell1.Width      = 900;
                    row10cell1.Text       = "<hr/>";
                    row10.Controls.Add(row10cell1);

                    tableQA.Controls.Add(row1);
                    tableQA.Controls.Add(row2);
                    tableQA.Controls.Add(row3);
                    tableQA.Controls.Add(row4);
                    tableQA.Controls.Add(row10);
                }
            }
            else
            {
                tableQA.Rows.Clear();

                TableHeaderRow  row  = new TableHeaderRow();
                TableHeaderCell cell = new TableHeaderCell();
                cell.ForeColor = System.Drawing.Color.Red;

                if (DropDownListType.SelectedIndex > 0)
                {
                    cell.Text = "No Questions Found for the type " + DropDownListType.SelectedItem.Text;
                }
                else
                {
                    cell.Text = "No Questions Found";
                }

                row.Controls.Add(cell);
                tableQA.Controls.Add(row);
            }
        }
    public Table[] vratiTabelaProizvodi(OracleDataReader drO)
    {
        int i = 1;
        int j = 0;
        int pat = 1;
        Table[] nova = new Table[100];
        TableHeaderCell head;
        TableCell cel;
        TableRow row = new TableRow();
        TableFooterRow foot;


        nova[j] = new Table();
        while (drO.Read())
        {
            if (pat == 1)
            {
                //nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Тип_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Данок_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Колинчина";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Потврди";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
                pat = 2;

            }
            if (i > 10)
            {
                i = 1;
                j++;
                row = new TableRow();
                nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Тип_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Колинчина";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Потврди";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
            }
            row = new TableRow();
            cel = new TableCell();
            cel.Text = i.ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDP"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDT"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDD"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Име"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Група"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Данок"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Цена"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            TextBox kolicinaTextBox = new TextBox();
            kolicinaTextBox.Text = "0";
            kolicinaTextBox.Width = Unit.Pixel(70);
            kolicinaTextBox.Style.Add("text-align", "right");
            kolicinaTextBox.Attributes.Add("onfocus", "proveriVlez(this)");
            kolicinaTextBox.Attributes.Add("onblur", "proveriIzlez(this)");
            kolicinaTextBox.ID = "kolicinaTextBox" + i.ToString();
            cel.Controls.Add(kolicinaTextBox);
            row.Controls.Add(cel);
            cel = new TableCell();
            Button insertBtn = new Button();
            insertBtn.Text = "Додади";
            insertBtn.ID = "dodadiBtn." + j.ToString() + "." + i.ToString();
            insertBtn.Click += insertKopce;
            cel.Controls.Add(insertBtn);
            row.Controls.Add(cel);
            nova[j].Controls.Add(row);
            i++;
        }
        Table[] kraj = new Table[j + 1];
        if (nova[0].Rows.Count > 0)
        {
            for (int w = 0; w <= j; w++)
            {
                foot = new TableFooterRow();
                cel = new TableCell();
                cel.ColumnSpan = 5;
                for (int q = 1; q <= j + 1; q++)
                {
                    Button kopce = new Button();
                    kopce.ID = q.ToString();
                    kopce.Click += new EventHandler(kopce_Click);
                    kopce.Text = q.ToString();
                    cel.Controls.Add(kopce);
                }
                foot.Controls.Add(cel);
                if (nova[w] != null)
                    nova[w].Rows.Add(foot);
                kraj[w] = nova[w];
            }
        }
        else
        {
            foot = new TableFooterRow();
            cel = new TableCell();
            cel.Text = " Нема такви  податоци во производи ";
            cel.BorderColor = System.Drawing.Color.White;
            cel.BorderWidth = Unit.Pixel(2);
            cel.BorderStyle = BorderStyle.Solid;
            foot.Controls.Add(cel);
            nova[0].Rows.Add(foot);
            kraj[0] = nova[0];
        }
        return kraj;
    }
    /// <summary>
    /// Page pre-render
    /// </summary>
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if ((Version != null) && (VersionCompare != null))
        {
            // Prepare header with rollback controls
            TableRow tr = new TableHeaderRow() { TableSection = TableRowSection.TableHeader };
            tr.CssClass = "unigrid-head";

            TableHeaderCell th = new TableHeaderCell();
            th.Text = GetString("lock.versionnumber");
            tr.Cells.Add(th);

            // Switch header sides if necessary
            if (VersionCompare.VersionID < Version.VersionID)
            {
                tr.Cells.Add(GetRollbackTableHeaderCell("compare", VersionCompare));
                tr.Cells.Add(GetRollbackTableHeaderCell("source", Version));
            }
            else
            {
                tr.Cells.Add(GetRollbackTableHeaderCell("source", Version));
                tr.Cells.Add(GetRollbackTableHeaderCell("compare", VersionCompare));
            }

            if ((viewDataSet.DataSet.Tables.Count <= 1) && (viewDataSet.CompareDataSet.Tables.Count <= 1))
            {
                viewDataSet.Table.Rows.RemoveAt(0);
            }
            viewDataSet.Table.Rows.AddAt(0, tr);
        }
    }
コード例 #29
0
    /// <summary>
    /// Generates the permission matrix for the current library.
    /// </summary>
    private void CreateMatrix()
    {
        // Get library resource info
        if ((ResLibrary != null) && (LibraryInfo != null))
        {
            // Get permissions for the current library resource
            DataSet permissions = PermissionNameInfoProvider.GetResourcePermissions(ResLibrary.ResourceID);
            if (DataHelper.DataSourceIsEmpty(permissions))
            {
                lblInfo.ResourceString = "general.emptymatrix";
                lblInfo.Visible = true;
            }
            else
            {
                TableRow headerRow = new TableRow();
                headerRow.TableSection = TableRowSection.TableHeader;
                headerRow.CssClass = "unigrid-head";

                TableHeaderCell newHeaderCell = new TableHeaderCell();
                newHeaderCell.CssClass = "first-column";
                headerRow.Cells.Add(newHeaderCell);

                DataView dv = permissions.Tables[0].DefaultView;
                dv.Sort = "PermissionDisplayName ASC";

                // Generate header cells
                foreach (DataRowView drv in dv)
                {
                    string permissionName = drv.Row["PermissionName"].ToString();
                    if (permissionArray.Contains(permissionName.ToLowerCSafe()))
                    {
                        newHeaderCell = new TableHeaderCell();
                        newHeaderCell.CssClass = "matrix-header";
                        newHeaderCell.Text = HTMLHelper.HTMLEncode(drv.Row["PermissionDisplayName"].ToString());
                        newHeaderCell.ToolTip = Convert.ToString(drv.Row["PermissionDescription"]);

                        headerRow.Cells.Add(newHeaderCell);
                    }
                }

                tblMatrix.Rows.Add(headerRow);

                // Render library access permissions
                object[,] accessNames = new object[5, 2];
                accessNames[0, 0] = GetString("security.nobody");
                accessNames[0, 1] = SecurityAccessEnum.Nobody;
                accessNames[1, 0] = GetString("security.allusers");
                accessNames[1, 1] = SecurityAccessEnum.AllUsers;
                accessNames[2, 0] = GetString("security.authenticated");
                accessNames[2, 1] = SecurityAccessEnum.AuthenticatedUsers;
                accessNames[3, 0] = GetString("security.groupmembers");
                accessNames[3, 1] = SecurityAccessEnum.GroupMembers;
                accessNames[4, 0] = GetString("security.authorizedroles");
                accessNames[4, 1] = SecurityAccessEnum.AuthorizedRoles;

                TableRow newRow;
                int rowIndex = 0;

                for (int access = 0; access <= accessNames.GetUpperBound(0); access++)
                {
                    SecurityAccessEnum currentAccess = ((SecurityAccessEnum)accessNames[access, 1]);
                    // If the security isn't displayed as part of group section
                    if (((currentAccess == SecurityAccessEnum.GroupAdmin) || (currentAccess == SecurityAccessEnum.GroupMembers)) && (!(LibraryInfo.LibraryGroupID > 0)))
                    {
                        // Do not render this access item
                    }
                    else
                    {
                        // Generate cell holding access item name
                        newRow = new TableRow();
                        TableCell newCell = new TableCell();
                        newCell.CssClass = "matrix-header";
                        newCell.Text = accessNames[access, 0].ToString();
                        newRow.Cells.Add(newCell);
                        rowIndex++;

                        // Render the permissions access items
                        int permissionIndex = 0;
                        for (int permission = 0; permission < (tblMatrix.Rows[0].Cells.Count - 1); permission++)
                        {
                            newCell = new TableCell();
                            int accessEnum = Convert.ToInt32(accessNames[access, 1]);
                            // Check if the currently processed access is applied for permission
                            bool isAllowed = CheckPermissionAccess(accessEnum, permission, tblMatrix.Rows[0].Cells[permission + 1].Text);

                            // Disable column in roles grid if needed
                            if ((currentAccess == SecurityAccessEnum.AuthorizedRoles) && !isAllowed)
                            {
                                gridMatrix.DisableColumn(permissionIndex);
                            }

                            // Insert the radio button for the current permission
                            var radio = new CMSRadioButton
                            {
                                Checked = isAllowed,
                                Enabled = Enable,
                            };
                            radio.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(this, permission + "|" + accessEnum));
                            newCell.Controls.Add(radio);

                            newRow.Cells.Add(newCell);
                            permissionIndex++;
                        }

                        // Add the access row to the table
                        tblMatrix.Rows.Add(newRow);
                    }
                }

                // Check if media library has some roles assigned
                headTitle.Visible = gridMatrix.HasData;

            }
        }
    }
コード例 #30
0
ファイル: fc11.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Normal || e.Row.RowState==DataControlRowState.Alternate)
        {

            string live = ((Label)(e.Row.FindControl("Label1"))).Text;
            DateTime live1 = DateTime.Parse(live.ToString(), System.Globalization.CultureInfo.CreateSpecificCulture("en-CA"));
            SqlDataAdapter adp = new SqlDataAdapter("select * from fc011 where dt='" + live1 + "'", ConfigurationManager.ConnectionStrings["ForestConnectionString"].ConnectionString);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                ((Label)(e.Row.FindControl("Label2"))).Text = ds.Tables[0].Rows[0][2].ToString();
                ((Label)(e.Row.FindControl("Label3"))).Text = ds.Tables[0].Rows[0][3].ToString();
                ((Label)(e.Row.FindControl("Label4"))).Text = ds.Tables[0].Rows[0][4].ToString();
                ((Label)(e.Row.FindControl("Label5"))).Text = ds.Tables[0].Rows[0][5].ToString();
                ((Label)(e.Row.FindControl("Label6"))).Text = ds.Tables[0].Rows[0][6].ToString();
                ((Label)(e.Row.FindControl("Label7"))).Text = ds.Tables[0].Rows[0][7].ToString();
                ((Label)(e.Row.FindControl("Label8"))).Text = ds.Tables[0].Rows[0][8].ToString();
                ((Label)(e.Row.FindControl("Label9"))).Text = ds.Tables[0].Rows[0][9].ToString();
                ((Label)(e.Row.FindControl("Label10"))).Text = ds.Tables[0].Rows[0][10].ToString();
                ((Label)(e.Row.FindControl("Label11"))).Text = ds.Tables[0].Rows[0][11].ToString();
                ((Label)(e.Row.FindControl("Label12"))).Text = ds.Tables[0].Rows[0][12].ToString();
                ((Label)(e.Row.FindControl("Label13"))).Text = ds.Tables[0].Rows[0][13].ToString();
                ((Label)(e.Row.FindControl("Label14"))).Text = ds.Tables[0].Rows[0][14].ToString();

            }
        }
        if (e.Row.RowState == DataControlRowState.Edit  )
        {
            DateTime dt=  Convert.ToDateTime(DateTime.Parse(     ((Label)(e.Row.FindControl("Label1"))).Text, System.Globalization.CultureInfo.CreateSpecificCulture("en-CA")));

            //string live =((Label)(e.Row.FindControl("Label1"))).Text;
           // DateTime live1 = DateTime.Parse(live.ToString(), System.Globalization.CultureInfo.CreateSpecificCulture("en-CA"));
            SqlDataAdapter adp = new SqlDataAdapter("select * from fc011 where dt='" + dt + "'", ConfigurationManager.ConnectionStrings["ForestConnectionString"].ConnectionString);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                //((TextBox)(e.Row.FindControl("TextBox1"))).Text = ds.Tables[0].Rows[0][2].ToString();
                //((TextBox)(e.Row.FindControl("TextBox2"))).Text = ds.Tables[0].Rows[0][3].ToString();
                //((TextBox)(e.Row.FindControl("TextBox3"))).Text = ds.Tables[0].Rows[0][4].ToString();
                //((TextBox)(e.Row.FindControl("TextBox4"))).Text = ds.Tables[0].Rows[0][5].ToString();
                //((TextBox)(e.Row.FindControl("TextBox5"))).Text = ds.Tables[0].Rows[0][6].ToString();
                //((TextBox)(e.Row.FindControl("TextBox6"))).Text = ds.Tables[0].Rows[0][7].ToString();
                //((TextBox)(e.Row.FindControl("TextBox7"))).Text = ds.Tables[0].Rows[0][8].ToString();
                //((TextBox)(e.Row.FindControl("TextBox8"))).Text = ds.Tables[0].Rows[0][9].ToString();
                //((TextBox)(e.Row.FindControl("TextBox9"))).Text = ds.Tables[0].Rows[0][10].ToString();
                //((TextBox)(e.Row.FindControl("TextBox10"))).Text = ds.Tables[0].Rows[0][11].ToString();
                //((TextBox)(e.Row.FindControl("TextBox11"))).Text = ds.Tables[0].Rows[0][12].ToString();
                //((TextBox)(e.Row.FindControl("TextBox12"))).Text = ds.Tables[0].Rows[0][13].ToString();
                //((TextBox)(e.Row.FindControl("TextBox13"))).Text = ds.Tables[0].Rows[0][14].ToString();
                //((TextBox)(e.Row.FindControl("TextBox14"))).Text = ds.Tables[0].Rows[0][15].ToString();
                //((TextBox)(e.Row.FindControl("TextBox15"))).Text = ds.Tables[0].Rows[0][16].ToString();
                //((TextBox)(e.Row.FindControl("TextBox16"))).Text = ds.Tables[0].Rows[0][17].ToString();
                //((TextBox)(e.Row.FindControl("TextBox17"))).Text = ds.Tables[0].Rows[0][18].ToString();
                //((TextBox)(e.Row.FindControl("TextBox18"))).Text = ds.Tables[0].Rows[0][19].ToString();
                //((TextBox)(e.Row.FindControl("TextBox19"))).Text = ds.Tables[0].Rows[0][20].ToString();
                //((TextBox)(e.Row.FindControl("TextBox20"))).Text = ds.Tables[0].Rows[0][21].ToString();
                //((TextBox)(e.Row.FindControl("TextBox21"))).Text = ds.Tables[0].Rows[0][22].ToString();
                //((Label)(e.Row.FindControl("Label1"))).Text = dt.ToString("dd/MM/yyyy");
                ////((Label)(e.Row.FindControl("TextBox23"))).Text = (Convert.ToDecimal(ds.Tables[0].Rows[0][6]) + Convert.ToDecimal(ds.Tables[0].Rows[0][8]) + Convert.ToDecimal(ds.Tables[0].Rows[0][10]) + Convert.ToDecimal(ds.Tables[0].Rows[0][12]) + Convert.ToDecimal(ds.Tables[0].Rows[0][14]) + Convert.ToDecimal(ds.Tables[0].Rows[0][16]) + Convert.ToDecimal(ds.Tables[0].Rows[0][18]) + Convert.ToDecimal(ds.Tables[0].Rows[0][20]) + Convert.ToDecimal(ds.Tables[0].Rows[0][22])).ToString();
                //((TextBox)(e.Row.FindControl("TextBox24"))).Text = ds.Tables[0].Rows[0][25].ToString();
                //((TextBox)(e.Row.FindControl("TextBox25"))).Text = ds.Tables[0].Rows[0][26].ToString();
                //((TextBox)(e.Row.FindControl("TextBox26"))).Text = ds.Tables[0].Rows[0][27].ToString();

            }
            else
            {
                //((TextBox)(e.Row.FindControl("TextBox1"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox2"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox3"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox4"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox5"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox6"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox7"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox8"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox9"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox10"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox11"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox12"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox13"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox14"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox15"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox16"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox17"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox18"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox19"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox20"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox21"))).Text = 0.ToString();
                ////((Label)(e.Row.FindControl("TextBox22"))).Text = (Convert.ToDecimal(ds.Tables[0].Rows[0][5]) + Convert.ToDecimal(ds.Tables[0].Rows[0][7]) + Convert.ToDecimal(ds.Tables[0].Rows[0][9]) + Convert.ToDecimal(ds.Tables[0].Rows[0][11]) + Convert.ToDecimal(ds.Tables[0].Rows[0][13]) + Convert.ToDecimal(ds.Tables[0].Rows[0][15]) + Convert.ToDecimal(ds.Tables[0].Rows[0][17]) + Convert.ToDecimal(ds.Tables[0].Rows[0][19]) + Convert.ToDecimal(ds.Tables[0].Rows[0][21])).ToString();
                ////((Label)(e.Row.FindControl("TextBox23"))).Text = (Convert.ToDecimal(ds.Tables[0].Rows[0][6]) + Convert.ToDecimal(ds.Tables[0].Rows[0][8]) + Convert.ToDecimal(ds.Tables[0].Rows[0][10]) + Convert.ToDecimal(ds.Tables[0].Rows[0][12]) + Convert.ToDecimal(ds.Tables[0].Rows[0][14]) + Convert.ToDecimal(ds.Tables[0].Rows[0][16]) + Convert.ToDecimal(ds.Tables[0].Rows[0][18]) + Convert.ToDecimal(ds.Tables[0].Rows[0][20]) + Convert.ToDecimal(ds.Tables[0].Rows[0][22])).ToString();
                //((TextBox)(e.Row.FindControl("TextBox24"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox25"))).Text = 0.ToString();
                //((TextBox)(e.Row.FindControl("TextBox26"))).Text = 0.ToString();
            }

        }
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
            GridViewRow row3 = new GridViewRow(4, 4, DataControlRowType.Header, DataControlRowState.Normal);
            GridViewRow row1 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
            Table t = (Table)GridView1.Controls[0];
            if (gv.HasControls())
            {

                row.HorizontalAlign = HorizontalAlign.Center;

                row1.HorizontalAlign = HorizontalAlign.Center;
                TableCell FileDate1 = new TableHeaderCell();
                FileDate1.Text = "Date";
                FileDate1.HorizontalAlign = HorizontalAlign.Center;
                row1.Cells.Add(FileDate1);
                TableCell FileDate2 = new TableHeaderCell();
                FileDate2.Text = "Tins";
                FileDate2.HorizontalAlign = HorizontalAlign.Center;
                row1.Cells.Add(FileDate2);
                TableCell FileDate3 = new TableHeaderCell();
                FileDate3.Text = "Drums";
                FileDate3.HorizontalAlign = HorizontalAlign.Center;
                row1.Cells.Add(FileDate3);

                TableCell FileDate4 = new TableHeaderCell();
                FileDate4.Text = "Net Wt with Sakki";
                row1.Cells.Add(FileDate4);

                TableCell FileDate5 = new TableHeaderCell();
                FileDate5.Text = "X";
                FileDate5.ColumnSpan = 2;

                row3.HorizontalAlign = HorizontalAlign.Center;
                TableCell FileDate51 = new TableHeaderCell();
                FileDate51.Text = "";
                FileDate51.ColumnSpan = 4;
                 row3.Cells.Add(FileDate51);

                TableCell FileDate52 = new TableHeaderCell();
                FileDate52.Text = "TPB";
                row3.Cells.Add(FileDate52);

                TableCell FileDate53 = new TableHeaderCell();
                FileDate53.Text = "wt.";
                row3.Cells.Add(FileDate53);

                TableCell FileDate54 = new TableHeaderCell();
                FileDate54.Text = "TPB";
                row3.Cells.Add(FileDate54);

                TableCell FileDate55 = new TableHeaderCell();
                FileDate55.Text = "wt.";
                row3.Cells.Add(FileDate55);

                TableCell FileDate56 = new TableHeaderCell();
                FileDate56.Text = "TPB";
                row3.Cells.Add(FileDate56);
                TableCell FileDate57 = new TableHeaderCell();
                FileDate57.Text = "wt.";
                row3.Cells.Add(FileDate57);
                TableCell FileDate58 = new TableHeaderCell();
                FileDate58.Text = "TPB";
                row3.Cells.Add(FileDate58);
                TableCell FileDate59 = new TableHeaderCell();
                FileDate59.Text = "wt.";
                row3.Cells.Add(FileDate59);
                TableCell FileDate60 = new TableHeaderCell();
                FileDate60.Text = "TPB";
                row3.Cells.Add(FileDate60);
                TableCell FileDate61 = new TableHeaderCell();
                FileDate61.Text = "wt.";
                row3.Cells.Add(FileDate61);
                TableCell FileDate62 = new TableHeaderCell();
                FileDate62.Text = "TPB";
                row3.Cells.Add(FileDate62);
                TableCell FileDate63 = new TableHeaderCell();
                FileDate63.Text = "wt.";
                row3.Cells.Add(FileDate63);
                TableCell FileDate64 = new TableHeaderCell();
                FileDate64.Text = "TPB";
                row3.Cells.Add(FileDate64);
                TableCell FileDate65 = new TableHeaderCell();
                FileDate65.Text = "wt.";
                row3.Cells.Add(FileDate65);

                TableCell FileDate66 = new TableHeaderCell();
                FileDate66.Text = "TPB";
                row3.Cells.Add(FileDate66);
                TableCell FileDate67 = new TableHeaderCell();
                FileDate67.Text = "wt.";
                row3.Cells.Add(FileDate67);

                TableCell FileDate68 = new TableHeaderCell();
                FileDate68.Text = "TPB";
                row3.Cells.Add(FileDate68);
                TableCell FileDate69 = new TableHeaderCell();
                FileDate69.Text = "wt.";
                row3.Cells.Add(FileDate69);

                TableCell FileDate70 = new TableHeaderCell();
                FileDate70.Text = "TPB";
                row3.Cells.Add(FileDate70);
                TableCell FileDate71 = new TableHeaderCell();
                FileDate71.Text = "wt.";
                row3.Cells.Add(FileDate71);

                TableCell FileDate72 = new TableHeaderCell();
                FileDate72.Text = "";
                FileDate72.ColumnSpan = 4;
                row3.Cells.Add(FileDate72);

                row1.Cells.Add(FileDate5);

                TableCell FileDate6 = new TableHeaderCell();
                FileDate6.Text = "WW";
                FileDate6.ColumnSpan = 2;
                row1.Cells.Add(FileDate6);

                TableCell FileDate7 = new TableHeaderCell();
                FileDate7.Text = "WG";
                FileDate7.ColumnSpan = 2;
                row1.Cells.Add(FileDate7);

                TableCell FileDate8 = new TableHeaderCell();
                FileDate8.Text = "N";
                FileDate8.ColumnSpan = 2;
                row1.Cells.Add(FileDate8);

                TableCell FileDate9 = new TableHeaderCell();
                FileDate9.Text = "M";
                FileDate9.ColumnSpan = 2;
                row1.Cells.Add(FileDate9);

                TableCell FileDate10 = new TableHeaderCell();
                FileDate10.Text = "K";
                FileDate10.ColumnSpan = 2;
                row1.Cells.Add(FileDate10);

                TableCell FileDate11 = new TableHeaderCell();
                FileDate11.Text = "H";
                FileDate11.ColumnSpan = 2;
                row1.Cells.Add(FileDate11);

                TableCell FileDate12 = new TableHeaderCell();
                FileDate12.Text = "D";
                FileDate12.ColumnSpan = 2;
                row1.Cells.Add(FileDate12);

                TableCell FileDate13 = new TableHeaderCell();
                FileDate13.Text = "B";
                FileDate13.ColumnSpan = 2;
                row1.Cells.Add(FileDate13);

                TableCell FileDate14 = new TableHeaderCell();
                FileDate14.Text = "Total";
                FileDate14.ColumnSpan = 2;
                row1.Cells.Add(FileDate14);

                TableCell FileDate15 = new TableHeaderCell();
                FileDate15.Text = "T.Oil";

                row1.Cells.Add(FileDate15);

                TableCell FileDate16 = new TableHeaderCell();
                FileDate16.Text = "Sign of production foreman";

                row1.Cells.Add(FileDate16);

                TableCell FileDate17 = new TableHeaderCell();
                FileDate17.Text = "Sign of factory manager";

                row1.Cells.Add(FileDate17);

                TableCell FileDate17a = new TableHeaderCell();
                FileDate17a.Text = "";

                row1.Cells.Add(FileDate17a);

                // Adding Cells
                TableCell FileDate = new TableHeaderCell();
                FileDate.Text = "Resin receipts for production";
                FileDate.ColumnSpan = 3;
                row.Cells.Add(FileDate);

                TableCell cell = new TableHeaderCell();
                cell.ColumnSpan = 25; // ********
                cell.Text = "Production figures Rosin For the month of";
                row.Cells.Add(cell);

                //}

            }
            //t.Rows.AddAt(0, row3);
            //t.Rows.AddAt(0, row1);
            //t.Rows.AddAt(0, row);
            //((Table)GridView1.Controls[0]).Rows.AddAt(1, row);
            //((Table)GridView1.Controls[0]).Rows.AddAt(1, row1);
            //((Table)GridView1.Controls[0]).Rows.AddAt(1, row3);
        }
    }
    /// <summary>
    /// Creates table.
    /// </summary>
    private void CreateTable(bool useDefaultValue)
    {
        Table table = new Table();

        table.CssClass    = "table table-hover";
        table.CellPadding = -1;
        table.CellSpacing = -1;

        // Create table header
        TableHeaderRow topHeader = new TableHeaderRow();
        TableHeaderRow header    = new TableHeaderRow();

        topHeader.TableSection = TableRowSection.TableHeader;
        header.TableSection    = TableRowSection.TableHeader;

        AddTableHeaderCell(topHeader, "");
        AddTableHeaderCell(topHeader, GetString("srch.local"), false, 3);

        AddTableHeaderCell(header, GetString("srch.settings.fieldname"), true);
        AddTableHeaderCell(header, GetString("development.content"), true);
        AddTableHeaderCell(header, GetString("srch.settings.searchable"), true);
        AddTableHeaderCell(header, GetString("srch.settings.tokenized"), true);

        if (DisplayAzureFields)
        {
            AddTableHeaderCell(topHeader, GetString("srch.azure"), false, 6);

            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.CONTENT), true);
            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.RETRIEVABLE), true);
            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.SEARCHABLE), true);

            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.FACETABLE), true);
            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.FILTERABLE), true);
            AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.SORTABLE), true);
        }

        if (DisplayIField)
        {
            AddTableHeaderCell(topHeader, GetString("general.general"));
            AddTableHeaderCell(header, GetString("srch.settings.ifield"), true);
        }

        var thc = new TableHeaderCell();

        thc.CssClass = "main-column-100";
        topHeader.Cells.Add(thc);

        thc          = new TableHeaderCell();
        thc.CssClass = "main-column-100";
        header.Cells.Add(thc);

        table.Rows.Add(topHeader);
        table.Rows.Add(header);
        pnlContent.Controls.Add(table);

        // Create table content
        if ((mAttributes != null) && (mAttributes.Count > 0))
        {
            // Create row for each field
            foreach (ColumnDefinition column in mAttributes)
            {
                SearchSettingsInfo ssi = null;
                TableRow           tr  = new TableRow();
                if (!DataHelper.DataSourceIsEmpty(mInfos))
                {
                    DataRow[] dr = mInfos.Tables[0].Select("name = '" + column.ColumnName + "'");
                    if ((dr.Length > 0) && (mSearchSettings != null))
                    {
                        ssi = mSearchSettings.GetSettingsInfo((string)dr[0]["id"]);
                    }
                }

                // Add cell with field name
                TableCell tc  = new TableCell();
                Label     lbl = new Label();
                lbl.Text = column.ColumnName;
                tc.Controls.Add(lbl);
                tr.Cells.Add(tc);

                var defaultSearchSettings = useDefaultValue ? SearchHelper.CreateDefaultSearchSettings(column.ColumnName, column.ColumnType) : null;

                tr.Cells.Add(CreateTableCell(SearchSettings.CONTENT, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.CONTENT) : ssi?.GetFlag(SearchSettings.CONTENT) ?? false, "development.content"));
                tr.Cells.Add(CreateTableCell(SearchSettings.SEARCHABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.SEARCHABLE) : ssi?.GetFlag(SearchSettings.SEARCHABLE) ?? false, "srch.settings.searchable"));
                tr.Cells.Add(CreateTableCell(SearchSettings.TOKENIZED, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.TOKENIZED) : ssi?.GetFlag(SearchSettings.TOKENIZED) ?? false, "srch.settings.tokenized"));

                if (DisplayAzureFields)
                {
                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.CONTENT, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.CONTENT) : ssi?.GetFlag(AzureSearchFieldFlags.CONTENT) ?? false, "srch.settings." + AzureSearchFieldFlags.CONTENT));
                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.RETRIEVABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.RETRIEVABLE) : ssi?.GetFlag(AzureSearchFieldFlags.RETRIEVABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.RETRIEVABLE));
                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.SEARCHABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.SEARCHABLE) : ssi?.GetFlag(AzureSearchFieldFlags.SEARCHABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.SEARCHABLE));

                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.FACETABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.FACETABLE) : ssi?.GetFlag(AzureSearchFieldFlags.FACETABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.FACETABLE));
                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.FILTERABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.FILTERABLE) : ssi?.GetFlag(AzureSearchFieldFlags.FILTERABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.FILTERABLE));
                    tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.SORTABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.SORTABLE) : ssi?.GetFlag(AzureSearchFieldFlags.SORTABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.SORTABLE));
                }

                // Add cell with 'iFieldname' value
                if (DisplayIField)
                {
                    tc = new TableCell();
                    CMSTextBox txt = new CMSTextBox();
                    txt.ID        = column.ColumnName + SearchSettings.IFIELDNAME;
                    txt.CssClass += " form-control";
                    txt.MaxLength = 200;
                    if (ssi != null)
                    {
                        txt.Text = ssi.FieldName;
                    }
                    tc.Controls.Add(txt);
                    tr.Cells.Add(tc);
                }
                tc = new TableCell();
                tr.Cells.Add(tc);
                table.Rows.Add(tr);
            }
        }
    }
コード例 #32
0
    protected void load_fields(object sender, EventArgs e)
    {
        SqlDataReader rdr;

        using (SqlConnection con = new SqlConnection("Data Source=i4bbv5vnt4.database.windows.net;Initial Catalog=TeamCacAh4UPauaP;Persist Security Info=True;User ID=TeamCache;Password=Password!"))
        {
            con.Open();
            SqlCommand cmd1 = new SqlCommand("SELECT acct_name, acct_bal, acct_type FROM Accounts", con);
            rdr = cmd1.ExecuteReader();

            if (rdr.HasRows)
            {
                while (rdr.Read())
                {
                    if (rdr["acct_type"].ToString() == "Assets" || rdr["acct_type"].ToString() == "Expenses")
                    {
                        TableRow tmp = new TableRow();
                        Table2.Rows.Add(tmp);
                        TableCell tmpN  = new TableCell();
                        TableCell tmpB  = new TableCell();
                        TableCell tmpBl = new TableCell();
                        tmpN.Text  = rdr["acct_name"].ToString();
                        tmpB.Text  = rdr["acct_bal"].ToString();
                        tmpBl.Text = "";
                        tmp.Cells.Add(tmpN);
                        tmp.Cells.Add(tmpB);
                        tmp.Cells.Add(tmpBl);
                    }

                    else if (rdr["acct_type"].ToString() == "Equity" || rdr["acct_type"].ToString() == "Liabilities" || rdr["acct_type"].ToString() == "Revenue Account")
                    {
                        TableRow tmp = new TableRow();
                        Table2.Rows.Add(tmp);
                        TableCell tmpN  = new TableCell();
                        TableCell tmpB  = new TableCell();
                        TableCell tmpBl = new TableCell();
                        tmpN.Text  = rdr["acct_name"].ToString();
                        tmpB.Text  = rdr["acct_bal"].ToString();
                        tmpBl.Text = "";
                        tmp.Cells.Add(tmpN);
                        tmp.Cells.Add(tmpBl);
                        tmp.Cells.Add(tmpB);
                    }
                }
            }
            //cmd1.ExecuteNonQuery();


            con.Close();
        }
        TableHeaderRow totalR = new TableHeaderRow();

        Table2.Rows.Add(totalR);
        TableHeaderCell totalC = new TableHeaderCell();

        totalC.Text = "Total: ";
        totalR.Cells.Add(totalC);
        TableHeaderCell totalDR = new TableHeaderCell();

        totalDR.Text = "$" + DRSum(sender, e);
        totalR.Cells.Add(totalDR);
        TableHeaderCell totalCR = new TableHeaderCell();

        totalCR.Text = "$" + CRSum(sender, e);
        totalR.Cells.Add(totalCR);
    }
コード例 #33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            {
                // ======== Process ===========
                // Head Table
                string[] ar = { "ชื่อกลุ่มวิชา (ภาษาไทย)", "ชื่อกลุ่มวิชา (ภาษาอังกฤษ)", "แก้ไข", "ลบ" };
                tblGroup.Attributes.Add("class", "table table-bordered table-striped table-hover");
                tblGroup.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    tRowHead.Cells.Add(cellHead);
                }
                tblGroup.Rows.Add(tRowHead);

                List <CourseGroup> courseGroup = new List <CourseGroup>();
                courseGroup = new CourseGroup().getCourseGroup();
                foreach (CourseGroup data in courseGroup)
                {
                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellCategoryThName = new TableCell();
                    cellCategoryThName.Text = data.CourseGroupThName;
                    tRowBody.Cells.Add(cellCategoryThName);

                    TableCell cellCategoryEnName = new TableCell();
                    cellCategoryEnName.Text = data.CourseGroupEnName;
                    tRowBody.Cells.Add(cellCategoryEnName);

                    TableCell cellEdit = new TableCell();
                    string    urlEdit  = "editGROUP.aspx?token=" + data.CourseGroupCode;
                    HyperLink hypEdit  = new HyperLink();
                    hypEdit.Attributes.Add("data-target", "#editModal");
                    hypEdit.Attributes.Add("data-toggle", "modal");
                    hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                    hypEdit.NavigateUrl = urlEdit;
                    hypEdit.ToolTip     = "Edit";
                    cellEdit.Controls.Add(hypEdit);
                    cellEdit.CssClass = "text-center";
                    cellEdit.Width    = 50;
                    tRowBody.Cells.Add(cellEdit);

                    TableCell cellDel = new TableCell();
                    string    urlDel  = "deleteGROUP.aspx?token=" + data.CourseGroupCode;
                    HyperLink hypDel  = new HyperLink();
                    hypDel.Attributes.Add("data-target", "#deleteModal");
                    hypDel.Attributes.Add("data-toggle", "modal");
                    hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                    hypDel.NavigateUrl = urlDel;
                    hypDel.ToolTip     = "Delete";
                    cellDel.Controls.Add(hypDel);
                    cellDel.CssClass = "text-center";
                    cellDel.Width    = 50;
                    tRowBody.Cells.Add(cellDel);

                    tblGroup.Rows.Add(tRowBody);
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
コード例 #34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Form.Attributes.Add("enctype", "multipart/form-data");

            ObjUsuario = Utilidades.ValidarSesion(HttpContext.Current.User.Identity as FormsIdentity, this);

            BoolEmpSuc = Mgr_Empresa.Get_Empresa_Sucursal(ObjUsuario);

            phEmpresa.Visible  = BoolEmpSuc.Item1;
            phSucursal.Visible = BoolEmpSuc.Item2;

            fechaInicial = Convert.ToDateTime("01/01/" + DateTime.Now.Year);
            fechaFinal   = Convert.ToDateTime("31/12/" + DateTime.Now.Year);

            if (!IsPostBack)
            {
                CargarListas();
            }
            else
            {
                foreach (var ctlID in Page.Request.Form.AllKeys)
                {
                    if (ctlID != null)
                    {
                        Control c = Page.FindControl(ctlID) as Control;
                        if (c is DropDownList)
                        {
                            if (c.ClientID.Contains("ddlSucursal"))
                            {
                                int nroTrabajadores = 0;
                                int cantGestiones   = 0;
                                //Buscar cantidad de trabajadores para la empresa seleccionada.(Cantidad de filas)
                                nroTrabajadores = Mgr_Trabajador.Get_Trabajadores_ByCapacidad(Convert.ToInt32(ddlSucursal.SelectedValue), fechaInicial, fechaFinal);
                                //Cantidad de gestiones laborales de tipo capacitacion para el trimestre seleccionado (Cantidad de Columnas)

                                cantGestiones = Mgr_GestionLaboral.Get_GestionLaboralByFecha(fechaInicial, fechaFinal);
                                if (nroTrabajadores > 0)
                                {
                                    crearTabla(nroTrabajadores, cantGestiones);
                                    phAsistenciasLeyenda.Visible = true;
                                }
                                else
                                {
                                    phAsistenciasLeyenda.Visible = false;

                                    Table _table;
                                    _table          = new Table();
                                    _table.ID       = "tbCapacitacion";
                                    _table.CssClass = "table";
                                    TableHeaderRow _header_fila = new TableHeaderRow();
                                    //Nro
                                    TableHeaderCell _header_celda = new TableHeaderCell();
                                    _header_celda.Text     = "No Existen trabajadores asociados a ninguna gestion laboral.";
                                    _header_celda.CssClass = "text-center";
                                    _header_fila.Cells.Add(_header_celda);
                                    _table.Rows.Add(_header_fila);
                                    pnTablaCapacitacion.Controls.Add(_table);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #35
0
        private void ShowResult(StuGLSearch stuGLSearch)
        {
            lblTitle.Text = Page.Title;
            // 當期資料
            GridView gvCurrentData = new GalaxyApp().CreatGridView("gvCurrentData", "gltable ", new CglFunc().CDicTOTable(new CglData().GetCurrentDataDics(stuGLSearch)), true, true);

            gvCurrentData.DataBind();
            pnlCurrentData.Controls.Add(gvCurrentData);

            #region Initialize
            InitialArray();
            #endregion Initialize

            #region Setup the Css of numbers
            dicNumcssclass = new Dictionary <string, string>();
            foreach (var KeyPair in dicCurrentNums)
            {
                if (KeyPair.Value > 0)
                {
                    dicNumcssclass.Add(KeyPair.Value.ToString(InvariantCulture), KeyPair.Key);
                }
            }
            #endregion Setup the Css of numbers

            #region dicTablePercent
            if (ViewState["dicTablePercent"] == null)
            {
                ViewState.Add("dicTablePercent", new CglTablePercent().GetTP(stuGLSearch, StrXmlDirectory, StrFnTPxml));
                //Update10(stuSearch00);
            }
            Dictionary <string, object> dicTablePercent = (Dictionary <string, object>)ViewState["dicTablePercent"];
            #endregion

            #region Data Part

            #region dtTpHit
            DataTable dtTpHit = new CglTablePercent().GetTablePercentHit(stuGLSearch, dicTablePercent);
            dtTpHit.TableName = string.Format(InvariantCulture, "dtTpHit_{0}", stuGLSearch.InDataRowsLimit);
            if (dtTpHit.Columns.Contains("TpHit02ID"))
            {
                dtTpHit.Columns.Remove("TpHit02ID");
            }
            if (dtTpHit.Columns.Contains("TpHit01ID"))
            {
                dtTpHit.Columns.Remove("TpHit01ID");
            }
            if (dtTpHit.Columns.Contains("lngTotalSN"))
            {
                dtTpHit.Columns.Remove("lngTotalSN");
            }
            if (dtTpHit.Columns.Contains("intDataRowsLimit"))
            {
                dtTpHit.Columns.Remove("intDataRowsLimit");
            }
            dtTpHit.DefaultView.Sort = "[srtCheck] DESC , [dblHitRate] ASC , [intTotal] DESC , [intHit] ASC";
            #endregion dtTpHit

            #region dtDHigh0125
            DataTable dtDHigh0125 = new CglTablePercent().GetDHigh0125(stuGLSearch, dicTablePercent);
            dtDHigh0125.TableName = string.Format(InvariantCulture, "dtDHigh0125_{0}_{1}", stuGLSearch.InDataRowsLimit, stuGLSearch.InCriticalNum);
            #endregion dtDHigh0125

            #region dtTpHit10
            DataTable dtTpHit10 = new CglTablePercent().GetTablePercentHit10(stuGLSearch, StrXmlDirectory, strFnTPHit10xml);
            dtTpHit10.TableName        = string.Format(InvariantCulture, "TpHit10_{0}", stuGLSearch.InDataRowsLimit);
            dtTpHit10.DefaultView.Sort = "[srtCheck] DESC ";
            #endregion dtTpHit10

            #region dtdicDelNum
            Dictionary <string, string> dicDelNum_All = new CglTablePercent().GetTPDelNum(stuGLSearch, dtTpHit, lstDelete, lstNotDelete);
            Dictionary <string, int>    dicDelNum     = ConvertToDicDelNum(dicDelNum_All);
            dicDelNum = dicDelNum.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, x => x.Value);
            DataTable dtdicDelNum = new CglFunc().CDicTOTable(dicDelNum, null);
            dtdicDelNum.TableName = string.Format(CultureInfo.InvariantCulture, "DelNum_{0}", stuGLSearch.InDataRowsLimit);
            #endregion dtdicDelNum

            #region dtdicDelNum_Hit
            DicDelNum_Hit = ConvertToDicDelNum_Hit(stuGLSearch, dicDelNum_All);
            DicDelNum_Hit = DicDelNum_Hit.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
            DataTable dtdicDelNum_Hit = new CglFunc().CDicTOTable(DicDelNum_Hit, null);
            dtdicDelNum_Hit.TableName = string.Format(CultureInfo.InvariantCulture, "DelNum_Hit{0}", stuGLSearch.InDataRowsLimit);
            #endregion dtdicDelNum_Hit

            #endregion Data Part

            #region Show the result

            StringBuilder sbDelete = new StringBuilder();
            sbDelete.AppendLine(string.Format(InvariantCulture, "DataRowsLimit : {0} ", stuGLSearch.InDataRowsLimit));
            sbDelete.AppendLine(string.Format(InvariantCulture, "Delete : {0} ", string.Join(",", lstDelete.ToArray())));
            sbDelete.AppendLine(string.Format(InvariantCulture, "NotDelete : {0} ", string.Join(",", lstNotDelete.ToArray())));
            pnlDetail.Controls.Add(new GalaxyApp().CreatLabel("lblDelete", sbDelete.ToString(), ""));

            #region dtdicDelNum
            Panel pnlDelNum = new GalaxyApp().CreatPanel(string.Format(InvariantCulture, "pnl{0}", "DelNum"), "max-width");
            pnlDetail.Controls.Add(pnlDelNum);

            #region SetButtons
            HyperLink hlDelNum = new GalaxyApp().CreatHyperLink("hlDelNum", "glbutton glbutton-lightblue ", "統計",
                                                                new Uri(string.Format(InvariantCulture, "#{0}", pnlDelNum.ID)));
            pnlButtons.Controls.Add(hlDelNum);
            #endregion SetButtons

            #region Set table tblDelNum
            Table tblDelNum = new GalaxyApp().CreatTable("gltable", dtdicDelNum.TableName);
            #region Set Columns of table tblHitCount
            TableHeaderRow thrHeader_DelNum = new TableHeaderRow();
            TableRow       trRow_DelNum     = new TableRow();
            foreach (DataColumn dcColumn in dtdicDelNum.Columns)
            {
                TableHeaderCell thcColumnFreq = new TableHeaderCell
                {
                    Text = string.Format(InvariantCulture, "{0:00}", int.Parse(dcColumn.ColumnName, InvariantCulture))
                };
                if (dicNumcssclass.ContainsKey(dcColumn.ColumnName))
                {
                    thcColumnFreq.CssClass = dicNumcssclass[dcColumn.ColumnName];
                }
                thrHeader_DelNum.Controls.Add(thcColumnFreq);

                using TableCell tcCell = new TableCell
                      {
                          Text = string.Format(InvariantCulture, "{0}", dtdicDelNum.Rows[0][dcColumn.ColumnName].ToString())
                      };
                trRow_DelNum.Controls.Add(tcCell);
            }
            tblDelNum.Controls.Add(thrHeader_DelNum);
            tblDelNum.Controls.Add(trRow_DelNum);
            #endregion
            #endregion

            pnlDelNum.Controls.Add(tblDelNum);

            #endregion dtdicDelNum

            #region dtdicDelNum_Hit

            #region Set panel pnlDelNum_Hit
            Panel pnlDelNum_Hit = new GalaxyApp().CreatPanel(string.Format(InvariantCulture, "pnl{0}", "DelNum_Hit"), "max-width");
            pnlDetail.Controls.Add(pnlDelNum_Hit);
            #endregion Set panel pnlHitCount

            GridView gvDelNum_Hit = new GalaxyApp().CreatGridView(dtdicDelNum_Hit.TableName, "gltable ", dtdicDelNum_Hit, true, false);
            gvDelNum_Hit.ShowHeaderWhenEmpty = true;
            gvDelNum_Hit.AllowSorting        = true;
            gvDelNum_Hit.Caption             = dtdicDelNum_Hit.TableName;
            if (gvDelNum_Hit.Columns.Count == 0)
            {
                for (int i = 0; i < dtdicDelNum_Hit.Columns.Count; i++)
                {
                    BoundField bfCell = new BoundField()
                    {
                        DataField  = dtdicDelNum_Hit.Columns[i].ColumnName,
                        HeaderText = dtdicDelNum_Hit.Columns[i].ColumnName,
                        ReadOnly   = true,
                    };
                    gvDelNum_Hit.Columns.Add(bfCell);
                }
            }
            gvDelNum_Hit.DataBind();
            pnlDelNum_Hit.Controls.Add(gvDelNum_Hit);
            #endregion dtdicDelNum_Hit

            #region dtDHigh0125
            #region SetButtons
            //HyperLink hlDHigh0125 = new HyperLink()
            //{
            //    ID = "hlDelNum",
            //    CssClass = "glbutton glbutton-lightblue ",
            //    Text = "統計",
            //    NavigateUrl = string.Format(InvariantCulture, "#pnl{0}", "DHigh0125")
            //};
            pnlButtons.Controls.Add(hlDelNum);
            #endregion SetButtons

            #region Set panel pnlDelNum
            //Panel pnlDHigh0125 = new Panel() { ID = string.Format(InvariantCulture, "pnl{0}", "DHigh0125"), CssClass = "max-width" };
            pnlDetail.Controls.Add(pnlDelNum);
            #endregion Set panel pnlHitCount

            #region Set table tblDelNum
            Table tblDHigh0125 = new GalaxyApp().CreatTable("gltable", string.Format(InvariantCulture, "{0}({1})", dtDHigh0125.TableName, dtDHigh0125.Columns.Count));
            #region Set Columns of table tblHitCount
            using (TableHeaderRow thrHeader_DHigh0125 = new TableHeaderRow())
            {
                using TableRow trRow_DHigh0125 = new TableRow();
                foreach (DataColumn dcColumn in dtDHigh0125.Columns)
                {
                    using (TableHeaderCell thcColumnFreq = new TableHeaderCell())
                    {
                        thcColumnFreq.Text = string.Format(InvariantCulture, "{0:00}", int.Parse(dcColumn.ColumnName, InvariantCulture));
                        thrHeader_DHigh0125.Controls.Add(thcColumnFreq);
                        if (dicNumcssclass.ContainsKey(int.Parse(dcColumn.ColumnName, InvariantCulture).ToString(InvariantCulture)))
                        {
                            thcColumnFreq.CssClass = dicNumcssclass[int.Parse(dcColumn.ColumnName, InvariantCulture).ToString(InvariantCulture)];
                        }
                    }
                    using TableCell tcCell = new TableCell
                          {
                              Text = string.Format(InvariantCulture, "{0}", dtDHigh0125.Rows[0][dcColumn.ColumnName].ToString())
                          };
                    trRow_DHigh0125.Controls.Add(tcCell);
                }
                #endregion
                tblDHigh0125.Controls.Add(thrHeader_DHigh0125);
                tblDHigh0125.Controls.Add(trRow_DHigh0125);
            }
            #endregion

            pnlDelNum.Controls.Add(tblDHigh0125);

            #endregion dtdicDelNum

            #region dtTpHit

            Panel pnlTpHit = new GalaxyApp().CreatPanel(string.Format(InvariantCulture, "pnl{0}", "TpHit"), "max-width");
            pnlDetail.Controls.Add(pnlTpHit);

            #region SetButtons
            HyperLink hlTpHit = new GalaxyApp().CreatHyperLink("hlTpHit", "glbutton glbutton-lightblue ", "TpHit",
                                                               new Uri(string.Format(InvariantCulture, "#{0}", pnlTpHit.ID)));
            pnlButtons.Controls.Add(hlTpHit);
            #endregion SetButtons

            #region gvdtTpHit
            GridView gvdtTpHit = new GalaxyApp().CreatGridView(dtTpHit.TableName, "gltable ", dtTpHit, true, false);
            gvdtTpHit.AllowSorting        = true;
            gvdtTpHit.Caption             = string.Format(InvariantCulture, "{0}({1})", dtTpHit.TableName, dtTpHit.Rows.Count);
            gvdtTpHit.ShowHeaderWhenEmpty = true;
            if (gvdtTpHit.Columns.Count == 0)
            {
                for (int i = 0; i < dtTpHit.Columns.Count; i++)
                {
                    BoundField bfCell = new BoundField()
                    {
                        DataField  = dtTpHit.Columns[i].ColumnName,
                        HeaderText = dtTpHit.Columns[i].ColumnName,
                        ReadOnly   = true,
                    };

                    if (i > 3)
                    {
                        bfCell.HeaderText = string.Format(InvariantCulture, "{0:00}", int.Parse(dtTpHit.Columns[i].ColumnName.Substring(4), InvariantCulture));
                        if (dicNumcssclass.ContainsKey(int.Parse(dtTpHit.Columns[i].ColumnName.Substring(4), InvariantCulture).ToString(InvariantCulture)))
                        {
                            bfCell.HeaderStyle.CssClass = dicNumcssclass[int.Parse(dtTpHit.Columns[i].ColumnName.Substring(4), InvariantCulture).ToString(InvariantCulture)];
                            bfCell.ItemStyle.CssClass   = dicNumcssclass[int.Parse(dtTpHit.Columns[i].ColumnName.Substring(4), InvariantCulture).ToString(InvariantCulture)];
                        }
                    }
                    gvdtTpHit.Columns.Add(bfCell);
                }
            }
            gvdtTpHit.RowDataBound += GvdtTpHit_RowDataBound;
            gvdtTpHit.DataBind();
            pnlTpHit.Controls.Add(gvdtTpHit);
            #endregion gvdtTpHit

            #endregion dtTpHit

            #region dtTpHit10

            Panel pnlTpHit10 = new GalaxyApp().CreatPanel(string.Format(InvariantCulture, "pnl{0}", "TpHit10"), "max-width");
            pnlDetail.Controls.Add(pnlTpHit10);

            #region SetButtons
            HyperLink hlTpHit10 = new GalaxyApp().CreatHyperLink("hlTpHit10", "glbutton glbutton-lightblue ", "TpHit10",
                                                                 new Uri(string.Format(InvariantCulture, "#{0}", pnlTpHit10.ID)));
            pnlButtons.Controls.Add(hlTpHit10);
            #endregion SetButtons

            #region gvTpHit10
            GridView gvTpHit10 = new GalaxyApp().CreatGridView(dtTpHit10.TableName, "gltable ", dtTpHit10, true, false);
            gvTpHit10.AllowSorting        = true;
            gvTpHit10.Caption             = string.Format(InvariantCulture, "{0}({1})", dtTpHit10.TableName, dtTpHit10.Rows.Count);
            gvTpHit10.ShowHeaderWhenEmpty = true;
            if (gvTpHit10.Columns.Count == 0)
            {
                for (int i = 0; i < dtTpHit10.Columns.Count; i++)
                {
                    BoundField bfCell = new BoundField()
                    {
                        DataField  = dtTpHit10.Columns[i].ColumnName,
                        HeaderText = dtTpHit10.Columns[i].Caption,
                        ReadOnly   = true,
                    };
                    if (i > 0)
                    {
                        if (bfCell.HeaderText.Contains("T"))
                        {
                            bfCell.HeaderStyle.CssClass = "row_lightyellow";
                            bfCell.ItemStyle.CssClass   = "row_lightyellow";
                        }
                    }
                    gvTpHit10.Columns.Add(bfCell);
                }
            }
            gvTpHit10.RowDataBound += GvTpHit10_RowDataBound;;
            gvTpHit10.DataBind();
            pnlTpHit10.Controls.Add(gvTpHit10);
            #endregion gvTpHit10

            #endregion dtTpHit10

            #endregion Show the result
        }
コード例 #36
0
    /// <summary>
    /// Generates the permission matrix for the cutrrent project.
    /// </summary>
    private void CreateMatrix()
    {
        // Get project resource info
        if (resProjects == null)
        {
            resProjects = ResourceInfoProvider.GetResourceInfo("CMS.ProjectManagement");
        }

        // Get project object
        if ((project == null) && (ProjectID > 0))
        {
            project = ProjectInfoProvider.GetProjectInfo(ProjectID);
        }

        if ((resProjects != null) && (project != null))
        {
            // Get permissions for the current project resource
            DataSet permissions = PermissionNameInfoProvider.GetResourcePermissions(resProjects.ResourceId);
            if (DataHelper.DataSourceIsEmpty(permissions))
            {
                lblInfo.Text = GetString("general.emptymatrix");
            }
            else
            {
                TableRow headerRow = new TableRow();
                headerRow.CssClass = "UniGridHead";
                TableCell newCell = new TableCell();
                TableHeaderCell newHeaderCell = new TableHeaderCell();
                newHeaderCell.Text = "&nbsp;";
                newHeaderCell.Attributes["style"] = "width:200px;";
                headerRow.Cells.Add(newHeaderCell);

                foreach (string permission in allowedPermissions)
                {
                    DataRow[] drArray = permissions.Tables[0].DefaultView.Table.Select("PermissionName = '" + permission + "'");
                    if ((drArray != null) && (drArray.Length > 0))
                    {
                        DataRow dr = drArray[0];
                        newHeaderCell = new TableHeaderCell();
                        newHeaderCell.Attributes["style"] = "text-align:center;white-space:nowrap;";
                        newHeaderCell.Text = dr["PermissionDisplayName"].ToString();
                        newHeaderCell.ToolTip = dr["PermissionDescription"].ToString();
                        newHeaderCell.HorizontalAlign = HorizontalAlign.Center;
                        headerRow.Cells.Add(newHeaderCell);
                    }
                    else
                    {
                        throw new Exception("[Security matrix] Column '" + permission + "' cannot be found.");
                    }
                }
                newHeaderCell = new TableHeaderCell();
                newHeaderCell.Text = "&nbsp;";
                headerRow.Cells.Add(newHeaderCell);

                tblMatrix.Rows.Add(headerRow);

                // Render project access permissions
                object[,] accessNames = new object[5,2];
                accessNames[0, 0] = GetString("security.nobody");
                accessNames[0, 1] = SecurityAccessEnum.Nobody;
                accessNames[1, 0] = GetString("security.allusers");
                accessNames[1, 1] = SecurityAccessEnum.AllUsers;
                accessNames[2, 0] = GetString("security.authenticated");
                accessNames[2, 1] = SecurityAccessEnum.AuthenticatedUsers;
                accessNames[3, 0] = GetString("security.groupmembers");
                accessNames[3, 1] = SecurityAccessEnum.GroupMembers;
                accessNames[4, 0] = GetString("security.authorizedroles");
                accessNames[4, 1] = SecurityAccessEnum.AuthorizedRoles;

                TableRow newRow = null;
                int rowIndex = 0;
                for (int access = 0; access <= accessNames.GetUpperBound(0); access++)
                {
                    SecurityAccessEnum currentAccess = ((SecurityAccessEnum)accessNames[access, 1]);

                    // If the security isn't displayed as part of group section
                    if ((currentAccess == SecurityAccessEnum.GroupMembers) && (project.ProjectGroupID == 0))
                    {
                        // Do not render this access item
                    }
                    else
                    {
                        // Generate cell holding access item name
                        newRow = new TableRow();
                        newRow.CssClass = ((rowIndex % 2 == 0) ? "EvenRow" : "OddRow");
                        newCell = new TableCell();
                        newCell.Text = accessNames[access, 0].ToString();
                        newCell.Wrap = false;
                        newCell.CssClass = "MatrixHeader";
                        newCell.Width = new Unit(28, UnitType.Percentage);
                        newRow.Cells.Add(newCell);
                        rowIndex++;

                        // Render the permissions access items
                        bool isAllowed = false;
                        bool isDisabled = (!Enable);
                        int permissionIndex = 0;
                        for (int permission = 0; permission < (tblMatrix.Rows[0].Cells.Count - 2); permission++)
                        {
                            newCell = new TableCell();

                            // Check if the currently processed access is applied for permission
                            isAllowed = CheckPermissionAccess(currentAccess, permission, tblMatrix.Rows[0].Cells[permission + 1].Text);

                            // Disable column in roles grid if needed
                            if ((currentAccess == SecurityAccessEnum.AuthorizedRoles) && !isAllowed)
                            {
                                gridMatrix.DisableColumn(permissionIndex);
                            }

                            // Insert the radio button for the current permission
                            string permissionText = tblMatrix.Rows[0].Cells[permission + 1].Text;
                            string elemId = ClientID + "_" + permission + "_" + access;
                            newCell.Text = "<label style=\"display:none;\" for=\"" + elemId + "\">" + permissionText + "</label><input type=\"radio\" id=\"" + elemId + "\" name=\"" + permissionText + "\" onclick=\"" +
                                           ControlsHelper.GetPostBackEventReference(this, permission.ToString() + ";" + Convert.ToInt32(currentAccess).ToString()) + "\" " +
                                           ((isAllowed) ? "checked = \"checked\"" : "") + ((isDisabled) ? " disabled=\"disabled\"" : "") + "/>";

                            newCell.Wrap = false;
                            newCell.Width = new Unit(12, UnitType.Percentage);
                            newCell.HorizontalAlign = HorizontalAlign.Center;
                            newRow.Cells.Add(newCell);
                            permissionIndex++;
                        }

                        newCell = new TableCell();
                        newCell.Text = "&nbsp;";
                        newRow.Cells.Add(newCell);

                        // Add the access row to the table
                        tblMatrix.Rows.Add(newRow);
                    }
                }

                // Check if project has some roles assigned
                mNoRolesAvailable = !gridMatrix.HasData;

                // Get permission matrix for current project resource
                if (!mNoRolesAvailable)
                {
                    // Security - Role separator
                    newRow = new TableRow();
                    newCell = new TableCell();
                    newCell.Text = "&nbsp;";
                    newCell.Attributes.Add("colspan", Convert.ToString(tblMatrix.Rows[0].Cells.Count));
                    newRow.Controls.Add(newCell);
                    tblMatrix.Rows.Add(newRow);

                    // Security - Role separator text
                    newRow = new TableRow();
                    newCell = new TableCell();
                    newCell.CssClass = "MatrixLabel";
                    newCell.Text = GetString("SecurityMatrix.RolesAvailability");
                    newCell.Attributes.Add("colspan", Convert.ToString(tblMatrix.Rows[0].Cells.Count));
                    newRow.Controls.Add(newCell);
                    tblMatrix.Rows.Add(newRow);
                }
            }
        }
    }
コード例 #37
0
    private void buildAssignTable()
    {
        List <TblGroups>       groups      = ServerModel.DB.Query <TblGroups>(null);
        IList <TblCurriculums> curriculums = TeacherHelper.CurrentUserCurriculums(FxCurriculumOperations.Use);

        Table_Assignments.Rows.Clear();

        //create header row
        TableRow        headerRow       = new TableRow();
        TableHeaderCell emptyHeaderCell = new TableHeaderCell();

        emptyHeaderCell.Text = "";
        headerRow.Cells.Add(emptyHeaderCell);
        foreach (TblGroups group in groups)
        {
            TableHeaderCell headerCell = new TableHeaderCell();
            headerCell.Text = group.Name;
            headerRow.Cells.Add(headerCell);
        }
        Table_Assignments.Rows.Add(headerRow);

        //create row for each curriculum
        foreach (TblCurriculums curriculum in curriculums)
        {
            TableRow        curriculumRow        = new TableRow();
            TableHeaderCell curriculumHeaderCell = new TableHeaderCell();
            curriculumHeaderCell.Text = curriculum.Name;
            curriculumRow.Cells.Add(curriculumHeaderCell);

            IList <TblGroups> assignedGroups = TeacherHelper.GetGroupsForCurriculum(curriculum);
            foreach (TblGroups group in groups)
            {
                bool isAssigned = false;
                foreach (TblGroups assignedGroup in assignedGroups)
                {
                    if (assignedGroup.ID == group.ID)
                    {
                        isAssigned = true;
                        break;
                    }
                }
                TableCell curriculumCell = new TableCell();
                if (isAssigned)
                {
                    Button modifyButton = new Button();
                    modifyButton.ID          = group.ID.ToString() + modifyChar + curriculum.ID;
                    modifyButton.Text        = modify;
                    modifyButton.PostBackUrl = ServerModel.Forms.BuildRedirectUrl <CurriculumTimelineController>(
                        new CurriculumTimelineController()
                    {
                        BackUrl      = Request.RawUrl,
                        GroupID      = group.ID,
                        CurriculumID = curriculum.ID
                    });

                    Button unsignButton = new Button();
                    unsignButton.ID     = group.ID.ToString() + unsignChar + curriculum.ID;
                    unsignButton.Click += new EventHandler(unsignButton_Click);
                    unsignButton.Text   = unsign;

                    curriculumCell.Controls.Add(modifyButton);
                    curriculumCell.Controls.Add(unsignButton);
                }
                else
                {
                    Button assignButton = new Button();
                    assignButton.ID     = group.ID.ToString() + assignChar + curriculum.ID;
                    assignButton.Click += new EventHandler(assignButton_Click);
                    assignButton.Text   = assign;

                    curriculumCell.Controls.Add(assignButton);
                }

                curriculumRow.Cells.Add(curriculumCell);
            }
            Table_Assignments.Rows.Add(curriculumRow);
        }
    }
コード例 #38
0
    /// <summary>
    /// Generate header of the matrix.
    /// </summary>
    /// <param name="matrixData">Data of the matrix to be generated</param>
    private void GenerateMatrixHeader(List<DataRow> matrixData)
    {
        // Prepare matrix header
        foreach (int index in ColumnOrderIndex)
        {
            DataRow dr = matrixData[index];

            if (ShowHeaderRow)
            {
                // Create header cell
                var thc = new TableHeaderCell
                {
                    Scope = TableHeaderScope.Column,
                    Text = HTMLHelper.HTMLEncode(MacroResolver.Resolve(Convert.ToString(dr[ColumnItemDisplayNameColumn]))),
                    ToolTip = (ColumnItemTooltipColumn != null) ? GetTooltip(dr, ItemTooltipColumn) : null,
                    EnableViewState = false
                };
                thrFirstRow.Cells.Add(thc);

                // Add disabled mark if needed
                if (!IsColumnEditable(dr[ColumnItemIDColumn]))
                {
                    thc.Text += DisabledColumnMark;
                }
            }
            else
            {
                // Create header cell
                var thc = new TableHeaderCell
                {
                    Scope = TableHeaderScope.Column,
                    Text = "&nbsp;",
                    EnableViewState = false
                };
                thrFirstRow.Cells.Add(thc);
            }
        }
    }
コード例 #39
0
        /// <summary>Performs the data binding.</summary>
        /// <param name="retrievedData">The retrieved data.</param>
        protected override void PerformDataBinding(System.Collections.IEnumerable retrievedData)
        {
            table.Rows.Clear();

            base.PerformDataBinding(retrievedData);

            if (this.Columns.Count == 0)
            {
                throw new Exception("List of columns is null or empty.");
            }

            if (retrievedData == null)
            {
                return;
            }

            this.SetPaginator(ref retrievedData);

            TableRow row;
            var      rowHeader = new TableRow();

            rowHeader.TableSection = TableRowSection.TableHeader;

            foreach (var boundColumn in this.Columns)
            {
                if (!DesignMode && TypeDescriptor.GetProperties(retrievedData.Cast <object>().First()).Find(boundColumn.FieldName, false) == null)
                {
                    throw new NullReferenceException(String.Format("Column with name '{0}' not founded in datasource.", boundColumn.FieldName));
                }

                var cellHeader = new TableHeaderCell()
                {
                    Text = boundColumn.Header
                };
                rowHeader.Cells.Add(cellHeader);
            }

            table.Rows.Add(rowHeader);

            foreach (object dataItem in retrievedData)
            {
                row = new TableRow();
                row.TableSection = TableRowSection.TableBody;

                foreach (BoundColumn boundColumn in this.Columns)
                {
                    var prop = TypeDescriptor.GetProperties(dataItem).Find(boundColumn.FieldName, false);
                    if (prop == null)
                    {
                        continue;
                    }

                    if (prop.GetValue(dataItem) == null)
                    {
                        row.Cells.Add(new TableCell());
                        continue;
                    }

                    switch (boundColumn.GetType().FullName)
                    {
                    case "Luzes.Core.UI.Web.Controls.Bootstrap.HyperlinkColumn":
                        row.Cells.Add(CreateHyperlinkColumn(prop, dataItem, (HyperlinkColumn)boundColumn));
                        break;

                    case "Luzes.Core.UI.Web.Controls.Bootstrap.DateColumn":
                        row.Cells.Add(CreateDateColumn(prop, dataItem, (DateColumn)boundColumn));
                        break;

                    case "Luzes.Core.UI.Web.Controls.Bootstrap.CheckBoxColumn":
                        row.Cells.Add(CreateCheckBoxColumn(prop, dataItem, (CheckBoxColumn)boundColumn));
                        break;

                    default:
                        row.Cells.Add(CreateColumn(prop, dataItem, boundColumn));
                        break;
                    }
                }

                table.Rows.Add(row);
            }
        }
    /// <summary>
    /// Display DataSet content.
    /// </summary>
    /// <param name="ds">DataSet to display</param>
    private void DisplayDataSet(DataSet ds)
    {
        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            // Prepare list of tables
            string        excludedTableNames = (ExcludedTableNames != null) ? ";" + ExcludedTableNames.Trim(';').ToLowerCSafe() + ";" : "";
            List <string> tables             = new List <string>();

            foreach (DataTable dt in ds.Tables)
            {
                if (!DataHelper.DataSourceIsEmpty(dt))
                {
                    string tableName = dt.TableName;
                    if (!excludedTableNames.Contains(";" + tableName.ToLowerCSafe() + ";"))
                    {
                        tables.Add(tableName);
                    }
                }
            }

            // Generate the tables ordered by object type display name
            foreach (string tableName in tables.OrderBy(x => GetString("ObjectType." + x)))
            {
                DataTable dt = ds.Tables[tableName];
                if (!DataHelper.DataSourceIsEmpty(dt))
                {
                    if (ds.Tables.Count > 1)
                    {
                        plcContent.Controls.Add(new LiteralControl(GetTableHeaderText(dt)));
                    }

                    Table contentTable;

                    if (!ForceRowDisplayFormat && (dt.Columns.Count >= 6) && !dt.TableName.EqualsCSafe(TranslationHelper.TRANSLATION_TABLE, true))
                    {
                        // Write all rows
                        foreach (DataRow dr in dt.Rows)
                        {
                            contentTable = new Table();
                            SetTable(contentTable);

                            // Set first table as table property
                            if (Table == null)
                            {
                                Table = contentTable;
                            }

                            // Create table header
                            TableCell labelCell = new TableHeaderCell();
                            labelCell.Text = GetString("General.FieldName");

                            TableCell valueCell = new TableHeaderCell();
                            valueCell.Text = GetString("General.Value");

                            AddRow(contentTable, labelCell, valueCell, null, "unigrid-head", true);

                            // Add values
                            foreach (DataColumn dc in dt.Columns)
                            {
                                string content = GetRowColumnContent(dr, dc, false);

                                if (ShowAllFields || !String.IsNullOrEmpty(content))
                                {
                                    labelCell      = new TableCell();
                                    labelCell.Text = "<strong>" + dc.ColumnName + "</strong>";

                                    valueCell      = new TableCell();
                                    valueCell.Text = content;
                                    AddRow(contentTable, labelCell, valueCell, null);
                                }
                            }

                            plcContent.Controls.Add(contentTable);
                            plcContent.Controls.Add(new LiteralControl("<br />"));
                        }
                    }
                    else
                    {
                        contentTable = new Table();
                        SetTable(contentTable);

                        // Add header
                        TableRow tr = new TableHeaderRow {
                            TableSection = TableRowSection.TableHeader
                        };
                        tr.CssClass = "unigrid-head";

                        int h = 1;
                        foreach (DataColumn column in dt.Columns)
                        {
                            TableHeaderCell th = new TableHeaderCell();
                            th.Text = ValidationHelper.GetString(column.Caption, column.ColumnName);

                            if (!ForceRowDisplayFormat && (h == dt.Columns.Count))
                            {
                                th.CssClass = "main-column-100";
                            }
                            tr.Cells.Add(th);
                            h++;
                        }
                        contentTable.Rows.Add(tr);

                        // Write all rows
                        foreach (DataRow dr in dt.Rows)
                        {
                            tr = new TableRow();

                            // Add values
                            foreach (DataColumn dc in dt.Columns)
                            {
                                TableCell tc    = new TableCell();
                                object    value = dr[dc.ColumnName];

                                // Possible DataTime columns
                                if ((dc.DataType == typeof(DateTime)) && (value != DBNull.Value))
                                {
                                    DateTime    dateTime    = Convert.ToDateTime(value);
                                    CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
                                    value = dateTime.ToString(cultureInfo);
                                }

                                string content = ValidationHelper.GetString(value, String.Empty);
                                tc.Text = EncodeDisplayedData ? HTMLHelper.HTMLEncode(content) : content;

                                if (!ForceRowDisplayFormat)
                                {
                                    tc.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                                }
                                tr.Cells.Add(tc);
                            }
                            contentTable.Rows.Add(tr);
                        }
                        plcContent.Controls.Add(contentTable);
                        plcContent.Controls.Add(new LiteralControl("<br />"));
                    }
                }
            }
        }
        else
        {
            Label lblError = new Label();
            lblError.CssClass = "InfoLabel";
            lblError.Text     = GetString("general.nodatafound");
            plcContent.Controls.Add(lblError);
        }
    }
    /// <summary>
    /// Generates the permission matrix for the cutrrent project.
    /// </summary>
    private void CreateMatrix()
    {
        // Get project resource info
        if (mResProjects == null)
        {
            mResProjects = ResourceInfoProvider.GetResourceInfo("CMS.ProjectManagement");
        }

        // Get project object
        if ((mProject == null) && (ProjectID > 0))
        {
            mProject = ProjectInfoProvider.GetProjectInfo(ProjectID);
        }

        if ((mResProjects != null) && (mProject != null))
        {
            // Get permissions for the current project resource
            DataSet permissions = PermissionNameInfoProvider.GetResourcePermissions(mResProjects.ResourceId);
            if (DataHelper.DataSourceIsEmpty(permissions))
            {
                lblInfo.Text = GetString("general.emptymatrix");
                lblInfo.Visible = true;
            }
            else
            {
                TableRow headerRow = new TableRow();
                headerRow.TableSection = TableRowSection.TableHeader;
                headerRow.CssClass = "unigrid-head";

                TableHeaderCell newHeaderCell = new TableHeaderCell();
                newHeaderCell.CssClass = "first-column";
                headerRow.Cells.Add(newHeaderCell);

                foreach (string permission in mAllowedPermissions)
                {
                    DataRow[] drArray = permissions.Tables[0].DefaultView.Table.Select("PermissionName = '" + permission + "'");
                    if (drArray.Length > 0)
                    {
                        DataRow dr = drArray[0];
                        newHeaderCell = new TableHeaderCell();
                        newHeaderCell.Text = dr["PermissionDisplayName"].ToString();
                        newHeaderCell.ToolTip = dr["PermissionDescription"].ToString();
                        headerRow.Cells.Add(newHeaderCell);
                    }
                    else
                    {
                        throw new Exception("[Security matrix] Column '" + permission + "' cannot be found.");
                    }
                }

                tblMatrix.Rows.Add(headerRow);

                // Render project access permissions
                object[,] accessNames = new object[5, 2];
                accessNames[0, 0] = GetString("security.nobody");
                accessNames[0, 1] = SecurityAccessEnum.Nobody;
                accessNames[1, 0] = GetString("security.allusers");
                accessNames[1, 1] = SecurityAccessEnum.AllUsers;
                accessNames[2, 0] = GetString("security.authenticated");
                accessNames[2, 1] = SecurityAccessEnum.AuthenticatedUsers;
                accessNames[3, 0] = GetString("security.groupmembers");
                accessNames[3, 1] = SecurityAccessEnum.GroupMembers;
                accessNames[4, 0] = GetString("security.authorizedroles");
                accessNames[4, 1] = SecurityAccessEnum.AuthorizedRoles;

                TableRow newRow;
                int rowIndex = 0;
                for (int access = 0; access <= accessNames.GetUpperBound(0); access++)
                {
                    SecurityAccessEnum currentAccess = ((SecurityAccessEnum)accessNames[access, 1]);

                    // If the security isn't displayed as part of group section
                    if ((currentAccess == SecurityAccessEnum.GroupMembers) && (mProject.ProjectGroupID == 0))
                    {
                        // Do not render this access item
                    }
                    else
                    {
                        // Generate cell holding access item name
                        newRow = new TableRow();
                        TableCell newCell = new TableCell();
                        newCell.Text = accessNames[access, 0].ToString();
                        newCell.CssClass = "matrix-header";
                        newRow.Cells.Add(newCell);
                        rowIndex++;

                        // Render the permissions access items
                        int permissionIndex = 0;
                        for (int permission = 0; permission < (tblMatrix.Rows[0].Cells.Count - 1); permission++)
                        {
                            newCell = new TableCell();

                            // Check if the currently processed access is applied for permission
                            bool isAllowed = CheckPermissionAccess(currentAccess, permission, tblMatrix.Rows[0].Cells[permission + 1].Text);

                            // Disable column in roles grid if needed
                            if ((currentAccess == SecurityAccessEnum.AuthorizedRoles) && !isAllowed)
                            {
                                gridMatrix.DisableColumn(permissionIndex);
                            }

                            // Insert the radio button for the current permission
                            var radio = new CMSRadioButton
                            {
                                Checked = isAllowed,
                                Enabled = Enable,
                            };
                            radio.Attributes.Add("onclick", ControlsHelper.GetPostBackEventReference(this, permission + ";" + Convert.ToInt32(currentAccess)));
                            newCell.Controls.Add(radio);

                            newRow.Cells.Add(newCell);
                            permissionIndex++;
                        }

                        // Add the access row to the table
                        tblMatrix.Rows.Add(newRow);
                    }
                }

                // Check if project has some roles assigned
                headTitle.Visible = gridMatrix.HasData;
            }
        }
    }
コード例 #42
0
        private TableHeaderCell NewCellHeader()
        {
            TableHeaderCell cell = new TableHeaderCell();

            return(cell);
        }
    /// <summary>
    /// Gets new table header cell which contains label and rollback image.
    /// </summary>
    /// <param name="suffixID">ID suffix</param>
    /// <param name="objectVersion">VersionHistoryInfo object</param>
    private TableHeaderCell GetRollbackTableHeaderCell(string suffixID, ObjectVersionHistoryInfo objectVersion)
    {
        TableHeaderCell tblHeaderCell = new TableHeaderCell();

        // Label
        Label lblValue = new Label();
        lblValue.ID = "lbl" + suffixID;
        lblValue.Text = HTMLHelper.HTMLEncode(GetVersionNumber(objectVersion.VersionNumber, objectVersion.VersionModifiedWhen)) + "&nbsp;";
        tblHeaderCell.Controls.Add(lblValue);

        // Add rollback controls if user authorized to modify selected object
        if (objectVersion.CheckPermissions(PermissionsEnum.Modify, SiteContext.CurrentSiteName, MembershipContext.AuthenticatedUser))
        {
            // Rollback image
            var imgRollback = new HyperLink();
            imgRollback.ID = "imgRollback" + suffixID;
            imgRollback.CssClass = "table-header-action";
            imgRollback.NavigateUrl = "#";

            string tooltip = null;
            string confirmText = null;

            var info = BaseAbstractInfoProvider.GetInfoById(Version.VersionObjectType, Version.VersionObjectID);
            var rollbackEnabled = !SynchronizationHelper.IsCheckedOutByOtherUser(info);

            // Set image action and description according to roll back type
            if (chkDisplayAllData.Checked)
            {
                tooltip = GetString("objectversioning.versionlist.versionfullrollbacktooltip");
                confirmText = GetString("objectversioning.versionlist.confirmfullrollback");
            }
            else
            {
                tooltip = GetString("history.versionrollbacktooltip");
                confirmText = GetString("Unigrid.ObjectVersionHistory.Actions.Rollback.Confirmation");
            }

            imgRollback.Text = tooltip;
            imgRollback.Enabled = rollbackEnabled;

            // Prepare onclick script
            if (rollbackEnabled)
            {
                var confirmScript = "if (confirm(\"" + confirmText + "\")) { ";
                confirmScript += ControlsHelper.GetPostBackEventReference(this, objectVersion.VersionID + "|" + chkDisplayAllData.Checked) + "; return false; }";
                imgRollback.Attributes.Add("onclick", confirmScript);
            }

            tblHeaderCell.Controls.Add(imgRollback);
        }

        return tblHeaderCell;
    }
コード例 #44
0
    /// <summary>
    /// Generates the permission matrix for the current forum.
    /// </summary>
    private void CreateMatrix()
    {
        // Get forum resource info
        if (resForums == null)
        {
            resForums = ResourceInfoProvider.GetResourceInfo("CMS.Forums");
        }

        // Get forum object
        if ((forum == null) && (ForumID > 0))
        {
            forum = ForumInfoProvider.GetForumInfo(ForumID);
        }

        if ((resForums != null) && (forum != null))
        {
            // Get permissions for the current forum resource
            DataSet permissions = PermissionNameInfoProvider.GetResourcePermissions(resForums.ResourceID);
            if (DataHelper.DataSourceIsEmpty(permissions))
            {
                ShowInformation(GetString("general.emptymatrix"));
            }
            else
            {
                TableHeaderRow headerRow = new TableHeaderRow();
                headerRow.CssClass     = "unigrid-head";
                headerRow.TableSection = TableRowSection.TableHeader;
                TableCell       newCell       = new TableCell();
                TableHeaderCell newHeaderCell = new TableHeaderCell();
                newHeaderCell.CssClass = "first-column";
                headerRow.Cells.Add(newHeaderCell);

                foreach (string permission in allowedPermissions)
                {
                    DataRow[] drArray = permissions.Tables[0].DefaultView.Table.Select("PermissionName = '" + permission + "'");
                    if (drArray.Length > 0)
                    {
                        DataRow dr = drArray[0];
                        newHeaderCell         = new TableHeaderCell();
                        newHeaderCell.Text    = dr["PermissionDisplayName"].ToString();
                        newHeaderCell.ToolTip = dr["PermissionDescription"].ToString();
                        headerRow.Cells.Add(newHeaderCell);
                    }
                    else
                    {
                        throw new Exception("[Security matrix] Column '" + permission + "' cannot be found.");
                    }
                }

                tblMatrix.Rows.Add(headerRow);

                // Render forum access permissions
                object[,] accessNames = new object[5, 2];
                accessNames[0, 0]     = GetString("security.nobody");
                accessNames[0, 1]     = SecurityAccessEnum.Nobody;
                accessNames[1, 0]     = GetString("security.allusers");
                accessNames[1, 1]     = SecurityAccessEnum.AllUsers;
                accessNames[2, 0]     = GetString("security.authenticated");
                accessNames[2, 1]     = SecurityAccessEnum.AuthenticatedUsers;
                accessNames[3, 0]     = GetString("security.groupmembers");
                accessNames[3, 1]     = SecurityAccessEnum.GroupMembers;
                accessNames[4, 0]     = GetString("security.authorizedroles");
                accessNames[4, 1]     = SecurityAccessEnum.AuthorizedRoles;

                TableRow newRow = null;
                for (int access = 0; access <= accessNames.GetUpperBound(0); access++)
                {
                    SecurityAccessEnum currentAccess = ((SecurityAccessEnum)accessNames[access, 1]);

                    // If the security isn't displayed as part of group section
                    if ((currentAccess == SecurityAccessEnum.GroupMembers) && (!IsGroupForum))
                    {
                        // Do not render this access item
                    }
                    else
                    {
                        // Generate cell holding access item name
                        newRow           = new TableRow();
                        newCell          = new TableCell();
                        newCell.Text     = accessNames[access, 0].ToString();
                        newCell.CssClass = "matrix-header";
                        newRow.Cells.Add(newCell);

                        // Render the permissions access items
                        bool isAllowed       = false;
                        bool isEnabled       = true;
                        int  permissionIndex = 0;
                        for (int permission = 0; permission < (tblMatrix.Rows[0].Cells.Count - 1); permission++)
                        {
                            newCell = new TableCell();

                            // Check if the currently processed access is applied for permission
                            isAllowed = CheckPermissionAccess(currentAccess, permission, tblMatrix.Rows[0].Cells[permission + 1].Text);
                            isEnabled = ((currentAccess != SecurityAccessEnum.AllUsers) || (permission != 1)) && Enable;

                            // Disable column in roles grid if needed
                            if ((currentAccess == SecurityAccessEnum.AuthorizedRoles) && !isAllowed)
                            {
                                gridMatrix.DisableColumn(permissionIndex);
                            }

                            // Insert the radio button for the current permission
                            var radio = new CMSRadioButton
                            {
                                Checked = isAllowed,
                                Enabled = isEnabled,
                            };
                            radio.Attributes.Add("onclick", ControlsHelper.GetPostBackEventReference(this, permission + ";" + Convert.ToInt32(currentAccess)));
                            newCell.Controls.Add(radio);

                            newRow.Cells.Add(newCell);
                            permissionIndex++;
                        }

                        // Add the access row to the table
                        tblMatrix.Rows.Add(newRow);
                    }
                }

                // Check if forum has some roles assigned
                headTitle.Visible = gridMatrix.HasData;
            }
        }
    }
コード例 #45
0
ファイル: fc11.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t = (Table)gv.Controls[0];

            // Adding Cells

            TableCell FileDate = new TableHeaderCell();

            FileDate.Text = "Date";

            row.Cells.Add(FileDate);

            TableCell cell = new TableHeaderCell();

            cell.Text = "Rosin B grade";

            row.Cells.Add(cell);

            t.Rows.AddAt(0, row);

            TableCell cell1 = new TableHeaderCell();

            cell1.Text = "T. Oil";

            row.Cells.Add(cell1);

            t.Rows.AddAt(0, row);

            TableCell cell2 = new TableHeaderCell();

            cell2.Text = "Bitumen";

            row.Cells.Add(cell2);

            t.Rows.AddAt(0, row);

            TableCell cell3 = new TableHeaderCell();

            cell3.Text = "Lime";

            row.Cells.Add(cell3);

            t.Rows.AddAt(0, row);

            TableCell cell4 = new TableHeaderCell();

            cell4.Text = "Black Lamp";

            row.Cells.Add(cell4);

            t.Rows.AddAt(0, row);

            TableCell cell6 = new TableHeaderCell();

            cell6.Text = "Steam Coal/Fuel Wood";

            row.Cells.Add(cell6);

            t.Rows.AddAt(0, row);

            TableCell cell7 = new TableHeaderCell();

            cell7.Text = "Daily Production";

            row.Cells.Add(cell7);

            t.Rows.AddAt(0, row);
            TableCell cell8 = new TableHeaderCell();

            cell8.Text = "Progressive Total";

            row.Cells.Add(cell8);

            t.Rows.AddAt(0, row);
            TableCell cell9 = new TableHeaderCell();

            cell9.Text = "Lot No.";

            row.Cells.Add(cell9);

            t.Rows.AddAt(0, row);
            TableCell cell10 = new TableHeaderCell();

            cell10.Text = "Batch No.";

            row.Cells.Add(cell10);

            t.Rows.AddAt(0, row);
            TableCell cell11 = new TableHeaderCell();

            cell11.Text = "Sign of Subsidiary Section Incharge";

            row.Cells.Add(cell11);

            t.Rows.AddAt(0, row);
            TableCell cell12 = new TableHeaderCell();

            cell12.Text = "Sign of FM/GM";

            row.Cells.Add(cell12);

            t.Rows.AddAt(0, row);

            t.Rows.AddAt(0, row);
            TableCell cell13 = new TableHeaderCell();

            TableCell cell14 = new TableHeaderCell();

            cell14.Text = "Remarks";

            row.Cells.Add(cell14);

            t.Rows.AddAt(0, row);

        }
    }
コード例 #46
0
ファイル: Info.cs プロジェクト: eboxy/database-project
        //Ger information om aktuell data i databas:
        public void button_info(HtmlGenericControl display, HtmlGenericControl display2,
                                Chart ch3DPie, Label lbl3DPie, Page sida)
        {
            OrderedDictionary dictRec = new OrderedDictionary();
            int rowcount = 0;

            try
            {
                dictRec  = db.GetInfo();
                rowcount = dictRec.Count;
            }
            finally
            { }


            //Value- och key-kollektioner initieras mha Interface:
            ICollection keyKollektion   = dictRec.Keys;
            ICollection valueKollektion = dictRec.Values;

            //Skapar arrays och kopierar kollektionerna till desamma:
            String[] keys   = new String[rowcount];
            int[]    values = new int[rowcount];
            keyKollektion.CopyTo(keys, 0);
            valueKollektion.CopyTo(values, 0);


            if (rowcount > 0)
            {
                //Rensar display från text och gridviews
                clr.Clean_surfaces(sida);

                DateTime Now = DateTime.Now;

                //Skapar de olika tabellerna:
                Table tblCDDVD     = new Table();
                Table tblVinyl     = new Table();
                Table tblDataMeida = new Table();
                Table tblKluster   = new Table();

                int sum_cddvd     = 0;
                int sum_vinyl     = 0;
                int sum_datamedia = 0;

                //Rubrik för infosidan:
                string add = "<h1>Följande info för tabeller finns: </h1>";
                display.InnerHtml = add;


                //Skriver ut CD/DVD-info om skivtabell:
                //Rubrikrad:
                TableRow rubrikrad_cddvd = new TableRow();
                tblCDDVD.Controls.Add(rubrikrad_cddvd);

                TableHeaderCell hcell_cddvd = new TableHeaderCell();
                //hcell_cddvd.BorderWidth = 1;
                hcell_cddvd.HorizontalAlign = HorizontalAlign.Left;
                hcell_cddvd.Text            = "CD/DVD:";
                rubrikrad_cddvd.Controls.Add(hcell_cddvd);

                //Tabellinnehåll:
                for (int i = 0; i < 11; i++)
                {
                    TableRow rad = new TableRow();
                    tblCDDVD.Controls.Add(rad);

                    TableCell cell = new TableCell();
                    //cell.BorderWidth = 1;
                    cell.Text = "Antal " + keys[i] + ": " + "<b>" + values[i] + "</b>";
                    rad.Controls.Add(cell);
                    sum_cddvd += values[i];
                }

                //Summeringsrad:
                TableRow sumrad_cddvd = new TableRow();

                TableHeaderCell hsumma_cddvd = new TableHeaderCell();
                hsumma_cddvd.HorizontalAlign = HorizontalAlign.Left;
                hsumma_cddvd.Text            = "Summa: " + sum_cddvd.ToString() + " cd/dvd(s)";
                sumrad_cddvd.Controls.Add(hsumma_cddvd);
                tblCDDVD.Controls.Add(sumrad_cddvd);



                //Skriver ut vinyl-info om skivtabell:
                //Rubrikrad:
                TableRow rubrikrad_vinyl = new TableRow();
                tblVinyl.Controls.Add(rubrikrad_vinyl);

                TableHeaderCell hcell_vinyl = new TableHeaderCell();
                //hcell_vinyl.BorderWidth = 1;
                hcell_vinyl.HorizontalAlign = HorizontalAlign.Left;
                hcell_vinyl.Text            = "Vinyl:";
                rubrikrad_vinyl.Controls.Add(hcell_vinyl);


                //Tabellinnehåll:
                for (int i = 11; i < 23; i++)
                {
                    TableRow rad = new TableRow();
                    tblVinyl.Controls.Add(rad);

                    TableCell cell = new TableCell();
                    //cell.BorderWidth = 1;
                    cell.Text = "Antal " + keys[i] + ": " + "<b>" + values[i] + "</b>";
                    rad.Controls.Add(cell);
                    sum_vinyl += values[i];
                }

                //Summeringsrad:
                TableRow sumrad_vinyl = new TableRow();

                TableHeaderCell hsumma_vinyl = new TableHeaderCell();
                hsumma_vinyl.HorizontalAlign = HorizontalAlign.Left;
                hsumma_vinyl.Text            = "Summa: " + sum_vinyl.ToString() + " vinyl(er)";
                sumrad_vinyl.Controls.Add(hsumma_vinyl);
                tblVinyl.Controls.Add(sumrad_vinyl);



                //Skriver ut datamedia-info om skivtabell:
                //Rubrikrad:
                TableRow rubrikrad_datam = new TableRow();
                tblDataMeida.Controls.Add(rubrikrad_datam);

                TableHeaderCell hcell_datam = new TableHeaderCell();
                //hcell_datam.BorderWidth = 1;
                hcell_datam.HorizontalAlign = HorizontalAlign.Left;
                hcell_datam.Text            = "Datamedia:";
                rubrikrad_datam.Controls.Add(hcell_datam);


                //Tabellinnehåll:
                //for (int i = 11; i < 23; i++)
                //{
                TableRow rad_datam = new TableRow();
                tblDataMeida.Controls.Add(rad_datam);

                TableCell cell_datam = new TableCell();
                //cell_datam.BorderWidth = 1;
                cell_datam.Text = "Antal " + keys[23] + ": " + "<b>" + values[23] + "</b>";
                rad_datam.Controls.Add(cell_datam);
                sum_datamedia += values[23];
                //}

                //Summeringsrad:
                TableRow sumrad_datamedia = new TableRow();

                TableHeaderCell hsumma_datamedia = new TableHeaderCell();
                hsumma_datamedia.HorizontalAlign = HorizontalAlign.Left;
                hsumma_datamedia.Text            = "Summa: " + sum_datamedia.ToString() + " mp3(s)";
                sumrad_datamedia.Controls.Add(hsumma_datamedia);
                tblDataMeida.Controls.Add(sumrad_datamedia);



                //Sätter upp layouten för ovanstående tabeller:
                TableRow rad_Kluster = new TableRow();

                TableCell cell1_Kluster = new TableCell();
                TableCell cell2_Kluster = new TableCell();
                TableCell cell3_Kluster = new TableCell();

                cell1_Kluster.Controls.Add(tblCDDVD);
                cell2_Kluster.Controls.Add(tblVinyl);
                cell3_Kluster.Controls.Add(tblDataMeida);

                cell1_Kluster.VerticalAlign = VerticalAlign.Top;
                cell2_Kluster.VerticalAlign = VerticalAlign.Top;
                cell3_Kluster.VerticalAlign = VerticalAlign.Top;

                rad_Kluster.Controls.Add(cell1_Kluster);
                rad_Kluster.Controls.Add(cell2_Kluster);
                rad_Kluster.Controls.Add(cell3_Kluster);

                tblKluster.Controls.Add(rad_Kluster);



                //Visar alla tabeller inkl. layout på displayen:
                display.Controls.Add(tblKluster);

                //Totalsumma för antal skivor i skivtabell:
                int totalsumma = sum_cddvd + sum_vinyl + sum_datamedia;


                //Visar tid när sidan skapades och totalsumma för skivdatabas:
                string add2 = "<h3 id=nogreen> Totalsumma för skivdatabas: " + totalsumma + " enheter </h3>";
                add2 += "<h3>" + "Sidan skapades: " + Now + "</h3>";
                display2.InnerHtml = add2;

                //Visar 3D-piechart + dess label:
                ch3DPie.Visible  = true;
                lbl3DPie.Visible = true;
            }
            else
            {
                //Rensar display från text och gridviews
                clr.Clean_surfaces(sida);

                display.InnerHtml = "<h2>Inga erhållna värden från databas.</h2>";
            }
        }
コード例 #47
0
    protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {

            GridView gv3 = sender as GridView;
            GridViewRow row3 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t3 = (Table)gv3.Controls[0];

            // Adding Cells
            TableCell FileDateb2 = new TableHeaderCell();
            FileDateb2.Text = "";
            row3.Cells.Add(FileDateb2);

            TableCell FileDateb3 = new TableHeaderCell();
            FileDateb3.Text = "Per Piece";
            row3.Cells.Add(FileDateb3);

            TableCell FileDateb4 = new TableHeaderCell();
            FileDateb4.Text = "Per M3";
            row3.Cells.Add(FileDateb4);

            TableCell FileDateb5 = new TableHeaderCell();
            FileDateb5.Text = "";
            row3.Cells.Add(FileDateb5);

            TableCell FileDateb6 = new TableHeaderCell();
            FileDateb6.Text = "Per Piece";
            row3.Cells.Add(FileDateb6);

            TableCell FileDateb7 = new TableHeaderCell();
            FileDateb7.Text = "Per M3";
            row3.Cells.Add(FileDateb7);

            TableCell FileDateb8 = new TableHeaderCell();
            FileDateb8.Text = "";
            row3.Cells.Add(FileDateb8);

            TableCell FileDateb9 = new TableHeaderCell();
            FileDateb9.Text = "Amt.";
            row3.Cells.Add(FileDateb9);

            TableCell FileDateb11 = new TableHeaderCell();
            FileDateb11.Text = "%";
            row3.Cells.Add(FileDateb11);

            t3.Rows.AddAt(0, row3);

            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t = (Table)gv.Controls[0];

            TableCell cell1 = new TableHeaderCell();
            cell1.Text = "Vol. M3";
            row.Cells.Add(cell1);

            TableCell cell2 = new TableHeaderCell();
            cell2.Text = "Rate Obtained Per Piece/Per M3";
            cell2.ColumnSpan = 2;
            row.Cells.Add(cell2);

            TableCell cell3 = new TableHeaderCell();
            cell3.Text = "Sale/Bid Ammount";

            row.Cells.Add(cell3);

            TableCell cell4 = new TableHeaderCell();
            cell4.ColumnSpan = 2;
            cell4.Text = "Floor Rate Per M3";
            row.Cells.Add(cell4);

            TableCell cell5 = new TableHeaderCell();
            cell5.Text = "Ammount";

            row.Cells.Add(cell5);

            TableCell cell6 = new TableHeaderCell();
            cell6.Text = "Variations (+/-)%";
            cell6.ColumnSpan = 2;
            row.Cells.Add(cell6);

            t.Rows.AddAt(0, row);

            Table t8 = (Table)gv.Controls[0];

        }
    }
コード例 #48
0
        //function to load company products
        private void LoadProducts()
        {
            BLL       obj         = new BLL();
            DataTable tabProducts = new DataTable();

            try
            {
                if (DropDownListCompanies.SelectedIndex > 0)
                {
                    if (DropDownListCategories.SelectedIndex > 0)
                    {
                        tabProducts = obj.GetProductsByCompanyIdandCategoryId(DropDownListCompanies.SelectedValue, int.Parse(DropDownListCategories.SelectedValue));
                    }
                    else
                    {
                        tabProducts = obj.GetProductsByCompany(DropDownListCompanies.SelectedValue);
                    }
                }
                else
                {
                    tabProducts = obj.GetAllProducts();
                }

                if (tabProducts.Rows.Count > 0)
                {
                    tableProducts.Rows.Clear();

                    tableProducts.BorderStyle = BorderStyle.Double;
                    tableProducts.GridLines   = GridLines.Both;
                    tableProducts.BorderColor = System.Drawing.Color.DarkGray;

                    TableRow headerrow = new TableRow();
                    headerrow.Height    = 30;
                    headerrow.ForeColor = System.Drawing.Color.WhiteSmoke;
                    headerrow.BackColor = System.Drawing.Color.Gray;

                    TableCell cell1 = new TableCell();
                    cell1.Text = "<b>Photo</b>";
                    headerrow.Controls.Add(cell1);

                    TableCell cell3 = new TableCell();
                    cell3.Text = "<b>Category Name</b>";
                    headerrow.Controls.Add(cell3);

                    TableCell cell4 = new TableCell();
                    cell4.Text = "<b>Product Name</b>";
                    headerrow.Controls.Add(cell4);

                    TableCell cell5 = new TableCell();
                    cell5.Text = "<b>Product Cost</b>";
                    headerrow.Controls.Add(cell5);

                    if (DropDownListCompanies.SelectedIndex > 0 && DropDownListCategories.SelectedIndex > 0)
                    {
                        TableCell cell6 = new TableCell();
                        cell6.Text = "<b>Rating</b>";
                        headerrow.Controls.Add(cell6);
                    }

                    tableProducts.Controls.Add(headerrow);

                    for (int cnt = 0; cnt < tabProducts.Rows.Count; cnt++)
                    {
                        TableRow row = new TableRow();
                        row.Height = 30;

                        TableCell cellPhoto = new TableCell();
                        cellPhoto.VerticalAlign = VerticalAlign.Top;
                        cellPhoto.Width         = 50;
                        cellPhoto.Height        = 50;
                        Image imgPhoto = new Image();
                        imgPhoto.Width    = 50;
                        imgPhoto.Height   = 50;
                        imgPhoto.ImageUrl = tabProducts.Rows[cnt]["ProductPhoto"].ToString();
                        cellPhoto.Controls.Add(imgPhoto);
                        row.Controls.Add(cellPhoto);

                        TableCell cellType = new TableCell();
                        cellType.Width = 150;

                        DataTable tabCategory = new DataTable();
                        tabCategory = obj.GetCategoryById(int.Parse(tabProducts.Rows[cnt]["CategoryId"].ToString()));

                        cellType.Text = tabCategory.Rows[0]["CategoryName"].ToString();
                        row.Controls.Add(cellType);

                        TableCell cellPName = new TableCell();
                        cellPName.Width = 150;
                        HyperLink hypPName = new HyperLink();
                        hypPName.Text        = tabProducts.Rows[cnt]["ProductName"].ToString();
                        hypPName.NavigateUrl = string.Format("~/Customer/ProductDetails.aspx?categoryId={0}&productId={1}&productName={2}", tabProducts.Rows[cnt]["CategoryId"].ToString(), tabProducts.Rows[cnt]["ProductId"].ToString(), tabProducts.Rows[cnt]["ProductName"].ToString());
                        cellPName.Controls.Add(hypPName);
                        row.Controls.Add(cellPName);

                        TableCell cellCost = new TableCell();
                        cellCost.Width = 150;
                        cellCost.Text  = tabProducts.Rows[cnt]["ProductCost"].ToString();
                        row.Controls.Add(cellCost);

                        if (DropDownListCompanies.SelectedIndex > 0 && DropDownListCategories.SelectedIndex > 0)
                        {
                            TableCell    cellRating         = new TableCell();
                            DropDownList dropdownlistRating = new DropDownList();
                            dropdownlistRating.Width = 200;
                            dropdownlistRating.ID    = tabProducts.Rows[cnt]["ProductId"].ToString();

                            for (int i = 1; i < 6; i++)
                            {
                                dropdownlistRating.Items.Add(i.ToString());
                            }

                            DataTable tabRatings = new DataTable();
                            tabRatings = obj.CheckCustomerRating(Session["CustomerId"].ToString(), int.Parse(tabProducts.Rows[cnt]["ProductId"].ToString()));

                            if (tabRatings.Rows.Count > 0)
                            {
                                string valueText = dropdownlistRating.Items.FindByValue(tabRatings.Rows[0]["Rating"].ToString()).ToString();

                                ListItem itemValue = new ListItem(valueText, tabRatings.Rows[0]["Rating"].ToString());
                                int      Index     = dropdownlistRating.Items.IndexOf(itemValue);

                                if (Index != -1)
                                {
                                    dropdownlistRating.SelectedIndex = Index;
                                }
                            }

                            cellRating.Controls.Add(dropdownlistRating);
                            row.Controls.Add(cellRating);
                        }

                        tableProducts.Controls.Add(row);
                    }
                }
                else
                {
                    tableProducts.Rows.Clear();
                    tableProducts.GridLines = GridLines.None;

                    TableHeaderRow  row  = new TableHeaderRow();
                    TableHeaderCell cell = new TableHeaderCell();
                    cell.Font.Bold  = true;
                    cell.ForeColor  = System.Drawing.Color.Red;
                    cell.ColumnSpan = 5;
                    cell.Text       = "No Products Found";
                    row.Controls.Add(cell);

                    tableProducts.Controls.Add(row);
                }
            }
            catch
            {
            }
        }
コード例 #49
0
ファイル: divindex.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {

            GridView gv = sender as GridView;
            //((Label)gv.HeaderRow.FindControl("label8")).Text = "dd".ToString();
            if (gv.HasControls())
            {

                GridViewRow row = new GridViewRow(0, 2, DataControlRowType.Header, DataControlRowState.Normal);
                Table t = (Table)GridView1.Controls[0];

                // Adding Cells
                TableCell FileDate = new TableHeaderCell();
                FileDate.Text = "Particulars";
                FileDate.ColumnSpan = 3;
                row.Cells.Add(FileDate);

                TableCell cell = new TableHeaderCell();
                cell.ColumnSpan = 7; // ********
                cell.Text = "CPF Subscription";
                row.Cells.Add(cell);
                //t.Rows.AddAt(0, row);

                //TableCell FileDate1 = new TableHeaderCell();
                //FileDate1.ColumnSpan = 0;
                //row.Cells.Add(FileDate1);

                //TableCell cell1 = new TableHeaderCell();
                //cell1.ColumnSpan = 4; // ********
                //cell1.Text = "Employer's Share";
                //row.Cells.Add(cell1);

                TableCell cell2 = new TableHeaderCell();
                cell2.ColumnSpan = 4; // ********
                cell2.Text = "Interest on Subscription";
                row.Cells.Add(cell2);
                t.Rows.AddAt(0, row);
                //TableCell cell3 = new TableHeaderCell();
                //cell3.ColumnSpan = 4; // ********
                //cell3.Text = "Interest on Employer Share";
                //row.Cells.Add(cell3);
                //TableCell cell4 = new TableHeaderCell();
                //cell4.ColumnSpan = 2; // ********
                //cell4.Text = "Progressive total issue";
                //row.Cells.Add(cell4);
                //TableCell cell5 = new TableHeaderCell();
                //cell5.ColumnSpan = 2; // ********
                //cell5.Text = "Balance";
                //row.Cells.Add(cell5);
                //TableCell cell6 = new TableHeaderCell();

                //cell6.Text = "";
                //row.Cells.Add(cell6);
                //t.Rows.AddAt(0, row);

                //next row
                //if (e.Row.RowType == DataControlRowType.Header)
                //{

                GridViewRow tr = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
                //for (short i = 1; i <= 13; ++i)
                //{
                TableCell td = new TableCell();
                td.Text = "1".ToString();
                tr.Cells.Add(td);
                //}

                TableCell td1 = new TableCell();
                td1.Text = "2".ToString();
                tr.Cells.Add(td1);

                TableCell td2 = new TableCell();
                td2.Text = "3".ToString();
                tr.Cells.Add(td2);
                TableCell td26 = new TableCell();
                td26.Text = "4".ToString();
                tr.Cells.Add(td26);

                TableCell td27 = new TableCell();
                td27.Text = "5".ToString();
                tr.Cells.Add(td27);
                TableCell td3 = new TableCell();
                td3.Text = "6".ToString();
                tr.Cells.Add(td3);

                TableCell td4 = new TableCell();
                td4.Text = "7".ToString();
                tr.Cells.Add(td4);

                TableCell td5 = new TableCell();
                td5.Text = "8".ToString();
                tr.Cells.Add(td5);

                TableCell td6 = new TableCell();
                td6.Text = "9".ToString();
                tr.Cells.Add(td6);

                TableCell td7 = new TableCell();
                td7.Text = "10".ToString();
                tr.Cells.Add(td7);

                //TableCell td8 = new TableCell();
                //td8.Text = "11".ToString();
                //tr.Cells.Add(td8);

                //TableCell td9 = new TableCell();
                //td9.Text = "12".ToString();
                //tr.Cells.Add(td9);

                //TableCell td10 = new TableCell();
                //td10.Text = "13".ToString();
                //tr.Cells.Add(td10);

                //TableCell td11 = new TableCell();
                //td11.Text = "14".ToString();
                //tr.Cells.Add(td11);

                TableCell td12 = new TableCell();
                td12.Text = "11".ToString();
                tr.Cells.Add(td12);

                TableCell td13 = new TableCell();
                td13.Text = "12".ToString();
                tr.Cells.Add(td13);

                TableCell td14 = new TableCell();
                td14.Text = "13".ToString();
                tr.Cells.Add(td14);

                TableCell td141 = new TableCell();
                td141.Text = "14".ToString();
                tr.Cells.Add(td141);

                //TableCell td142 = new TableCell();
                //td142.Text = "19".ToString();
                //tr.Cells.Add(td142);

                //TableCell td143 = new TableCell();
                //td143.Text = "20".ToString();
                //tr.Cells.Add(td143);
                //TableCell td144 = new TableCell();
                //td144.Text = "21".ToString();
                //tr.Cells.Add(td144);

                //TableCell td145 = new TableCell();
                //td145.Text = "22".ToString();
                //tr.Cells.Add(td145);

                TableCell td146 = new TableCell();
                td146.Text = "15".ToString();
                tr.Cells.Add(td146);

                //TableCell td147 = new TableCell();
                //td147.Text = "16".ToString();
                //tr.Cells.Add(td147);
                ((Table)gv.Controls[0]).Rows.Add(tr);
                //}

            }
        }
    }
コード例 #50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    //โหลดแขนงวิชา
                    string sql = "Select * From SPECIAL_FIELD Order By SPEC_FIELD_CODE";
                    specialFData = specialFObj.getSpecialFieldManual(sql);

                    // Head Table
                    string[] ar = { "รหัส", "ชื่อย่อ", "ชื่อแขนงวิชา (thai)", "ชื่อแขนงวิชา (English)", "คณะ", "สถานะ", "แก้ไข", "ลบ" };
                    //Table tb1 = new Table();
                    tblSpecialField.Attributes.Add("class", "table table-bordered table-striped table-hover");
                    tblSpecialField.Attributes.Add("id", "dt_basic");
                    TableHeaderRow tRowHead = new TableHeaderRow();
                    tRowHead.TableSection = TableRowSection.TableHeader;
                    for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                    {
                        // Create a new cell and add it to the row.
                        TableHeaderCell cellHead = new TableHeaderCell();
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tblSpecialField.Rows.Add(tRowHead);

                    foreach (SpecialFieldData data in specialFData)
                    {
                        //ตรวจสอบสถานะการใช้งานของคณะ
                        if (new Faculty().getFaculty(data.SpecialField_FacultyCode).Faculty_Status != "0001")
                        {
                            continue;
                        }
                        else
                        {
                            TableRow tRowBody = new TableRow();
                            tRowBody.TableSection = TableRowSection.TableBody;

                            TableCell cellCode = new TableCell();
                            cellCode.Text = data.SpecialField_Code;
                            tRowBody.Cells.Add(cellCode);

                            TableCell cellShortName = new TableCell();
                            cellShortName.Text = data.SpecialField_ShortName;
                            tRowBody.Cells.Add(cellShortName);

                            TableCell cellThai = new TableCell();
                            cellThai.Text = data.SpecialField_Thai;
                            tRowBody.Cells.Add(cellThai);

                            TableCell cellEng = new TableCell();
                            cellEng.Text = data.SpecialField_Eng;
                            tRowBody.Cells.Add(cellEng);

                            TableCell   cellFaculty = new TableCell();
                            FacultyData fac         = new Faculty().getFaculty(data.SpecialField_FacultyCode);
                            cellFaculty.Text = fac.Faculty_Thai;
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellStatus = new TableCell();
                            //0001 = ใช้งาน
                            if (data.SpecialField_Status == "0001")
                            {
                                cellStatus.Text    = "<h4 class='txt-color-green'><i class='fa fa-check'></i></h4>";
                                cellStatus.ToolTip = "ใช้งาน";
                            }
                            //0002 = ไม่ใช้งาน
                            if (data.SpecialField_Status == "0002")
                            {
                                cellStatus.Text    = "<h4 class='txt-color-red'><i class='fa fa-times'></i></h4>";
                                cellStatus.ToolTip = "ไม่ใช้งาน";
                            }
                            cellStatus.CssClass = "text-center";
                            tRowBody.Cells.Add(cellStatus);

                            TableCell cellEdit = new TableCell();
                            string    urlEdit  = "edit_Special_Field.aspx?token=" + data.SpecialField_Code;
                            HyperLink hypEdit  = new HyperLink();
                            hypEdit.Attributes.Add("data-target", "#editSpecial_Field");
                            hypEdit.Attributes.Add("data-toggle", "modal");
                            hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "Edit";
                            cellEdit.Controls.Add(hypEdit);
                            cellEdit.CssClass = "text-center";
                            tRowBody.Cells.Add(cellEdit);

                            TableCell cellDel = new TableCell();
                            //string urlDel = "#";
                            string    urlDel = "delete_Special_Field.aspx?token=" + data.SpecialField_Code;
                            HyperLink hypDel = new HyperLink();
                            hypDel.Attributes.Add("data-target", "#deleteSpecial_Field");
                            hypDel.Attributes.Add("data-toggle", "modal");
                            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                            hypDel.NavigateUrl = urlDel;
                            hypDel.ToolTip     = "Delete";
                            cellDel.Controls.Add(hypDel);
                            cellDel.CssClass = "text-center";
                            tRowBody.Cells.Add(cellDel);

                            tblSpecialField.Rows.Add(tRowBody);
                        }
                    }
                }    //end !Page.IsPostBack
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
コード例 #51
0
    private void parseResponse(string soapResult, string action)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(soapResult);
        XmlNamespaceManager manager = new XmlNamespaceManager(doc.NameTable);
        manager.AddNamespace("ns", "http://www.nbrm.mk/klservice/");
        XmlNode node = doc.DocumentElement.SelectSingleNode("//ns:GetExchangeRatesResult", manager);
        string text = node.FirstChild.InnerText;

        if (text.Contains("Formatot na parametarot"))
        {
            MyPanel.Visible = true;
            MyTable.Visible = false;
            return;
        }

        MyPanel.Visible = false;
        MyTable.Visible = true;

        string[] parts = text.Split(new string[] { "<KursZbir>", "</KursZbir>" }, StringSplitOptions.None);

        MyTable.Rows.Clear();

        TableHeaderRow row = new TableHeaderRow();

        TableHeaderCell cell = new TableHeaderCell();
        cell.Text = "Date";
        cell.Style.Add("text-align", "center");
        TableHeaderCell cell1 = new TableHeaderCell();
        cell1.Text = "Currency";
        cell1.Style.Add("text-align", "center");
        TableHeaderCell cell2 = new TableHeaderCell();
        cell2.Text = "Unit";
        cell2.Style.Add("text-align", "center");
        TableHeaderCell cell3 = new TableHeaderCell();
        cell3.Text = "Buying rate";
        cell3.Style.Add("text-align", "center");
        TableHeaderCell cell4 = new TableHeaderCell();
        cell4.Text = "Average rate";
        cell4.Style.Add("text-align", "center");
        TableHeaderCell cell5 = new TableHeaderCell();
        cell5.Text = "Selling rate";
        cell5.Style.Add("text-align", "center");

        row.Cells.Add(cell);
        row.Cells.Add(cell1);
        row.Cells.Add(cell2);
        row.Cells.Add(cell3);
        row.Cells.Add(cell4);
        row.Cells.Add(cell5);

        MyTable.Rows.Add(row);

        foreach (string part in parts)
        {
            if (part.Trim().Equals("") || part.StartsWith("<dsKurs>") || part.StartsWith("</dsKurs>"))
            {
                continue;
            }

            string[] otherParts = part.Split(new string[] { "<Datum>", "</Datum>" }, StringSplitOptions.None);

            if (otherParts.Length > 0)
            {
                try
                {
                    TableRow tempRow = new TableRow();

                    string datum = otherParts[1];
                    DateTime date = Convert.ToDateTime(datum);
                    TableCell tempCell1 = new TableCell();
                    if (date.Month <= 9)
                    {
                        tempCell1.Text = date.Day + ".0" + date.Month + "." + date.Year;
                    }
                    else
                    {
                        tempCell1.Text = date.Day + "." + date.Month + "." + date.Year;
                    }
                    
                    tempCell1.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell1);

                    string[] partsS = otherParts[2].Split(new string[] { "<Oznaka>", "</Oznaka>" }, StringSplitOptions.None);
                    string oznaka = partsS[1];
                    TableCell tempCell = new TableCell();
                    tempCell.Text = oznaka;
                    tempCell.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell);

                    string[] parts2 = partsS[2].Split(new string[] { "<Nomin>", "</Nomin>" }, StringSplitOptions.None);
                    string nomin = parts2[1];
                    TableCell tempCell2 = new TableCell();
                    tempCell2.Text = nomin;
                    tempCell2.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell2);

                    string[] parts3 = parts2[2].Split(new string[] { "<Kupoven>", "</Kupoven>" }, StringSplitOptions.None);
                    string kupoven = parts3[1];
                    TableCell tempCell3 = new TableCell();
                    tempCell3.Text = kupoven;
                    tempCell3.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell3);

                    string[] parts4 = parts3[2].Split(new string[] { "<Sreden>", "</Sreden>" }, StringSplitOptions.None);
                    string sreden = parts4[1];
                    TableCell tempCell4 = new TableCell();
                    tempCell4.Text = sreden;
                    tempCell4.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell4);

                    string[] parts5 = parts4[2].Split(new string[] { "<Prodazen>", "</Prodazen>" }, StringSplitOptions.None);
                    string prodazen = parts5[1];
                    TableCell tempCell5 = new TableCell();
                    tempCell5.Text = prodazen;
                    tempCell5.Style.Add("text-align", "center");
                    tempRow.Cells.Add(tempCell5);

                    MyTable.Rows.Add(tempRow);

                }
                catch (Exception ex)
                {

                }
            }
        }
    }
コード例 #52
0
ファイル: ManageChuQin.aspx.cs プロジェクト: Mike-gif/testgit
    protected void afternoon_Click(object sender, EventArgs e)
    {
        if (Session["number"] == null)
        {
            Response.Write("<script>alert('登录时间过期,请重新登录');window.location='../login.aspx';</script>");
            return;
        }
        if (ddl_number.Text == "")
        {
            return;
        }
        DateTime time1 = Convert.ToDateTime(startime.Text);
        DateTime time2 = Convert.ToDateTime(endtime.Text);

        System.TimeSpan ND = time2 - time1;
        int             n  = ND.Days; //天数差

        if (time1 > time2)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('开始时间大于结束时间,请重新选择')</script>");
        }
        else
        {
            if (n > 31)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能查询31天以内的记录,请重新选择')</script>");
            }
            else
            {
                string         gettime1 = "", gettime2 = "", gettime3 = "", gettime4 = "", gettime5 = "", getcanbu = "", getchebu = "", getchidao = "", getzaotiu = "", getqueqin = "", getligang = "", getnianxiu = "", getshijia = "", getlinshijia = "", getbingjia = "", getkuanggong = "";//获取早上考勤时间,允许迟到时间,旷工时间,午休时间,下午下班时间,加班时间,迟到时间,早退时间,旷工时间
                double         TADD1 = 0, TADD2 = 0, TADD3 = 0, TADD4 = 0;
                int            FADD = 0;
                double         CANADD = 0, CHEADD = 0;
                String         sql1 = "SELECT * FROM [KaoQinCanShu] where banci=@number";
                SqlParameter[] sps1 = new SqlParameter[]
                {
                    new SqlParameter("@number", ddr_banci.SelectedItem.Text),
                };
                using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql1, sps1))
                {
                    if (dr.Read())
                    {
                        gettime1     = dr.GetString(dr.GetOrdinal("time1"));
                        gettime2     = dr.GetString(dr.GetOrdinal("time2"));
                        gettime3     = dr.GetString(dr.GetOrdinal("time3"));
                        gettime4     = dr.GetString(dr.GetOrdinal("time4"));
                        gettime5     = dr.GetString(dr.GetOrdinal("time5"));//晚班时间
                        getcanbu     = dr.GetString(dr.GetOrdinal("canbu"));
                        getchebu     = dr.GetString(dr.GetOrdinal("chebu"));
                        getchidao    = dr.GetString(dr.GetOrdinal("chidao"));
                        getzaotiu    = dr.GetString(dr.GetOrdinal("zaotiu"));
                        getqueqin    = dr.GetString(dr.GetOrdinal("queqin"));
                        getligang    = dr.GetString(dr.GetOrdinal("ligang"));
                        getnianxiu   = dr.GetString(dr.GetOrdinal("nianxiu"));
                        getshijia    = dr.GetString(dr.GetOrdinal("shijia"));
                        getlinshijia = dr.GetString(dr.GetOrdinal("linshijia"));
                        getbingjia   = dr.GetString(dr.GetOrdinal("bingjia"));
                        getkuanggong = dr.GetString(dr.GetOrdinal("kuanggong"));
                    }
                    SqlHelper.Close();
                }
                TableHeaderRow thr = new TableHeaderRow();
                //构建表头
                string[] s_th = "日期,第一次刷卡(到岗)时间,最后一次刷卡(离岗)时间,累计在岗(小时),累计上岗时间(小时),累计离岗时间(小时),累计加班时间(小时),餐补,车补,缺勤,状态(早、晚),考勤分(扣分)".Split(',');
                foreach (string _s in s_th)
                {
                    TableHeaderCell thd = new TableHeaderCell();
                    thd.Text = _s;
                    thr.Cells.Add(thd);
                }

                tb_result.Rows.Add(thr);
                //int i = 0;
                for (int i = 0; i <= n; i++)
                {
                    TableRow tr = new TableRow();
                    //日期

                    String    strendti  = time1.AddDays(i).ToString("yyyy-MM-dd");
                    string    starttime = time1.AddDays(1 + i).ToString("yyyy-MM-dd");
                    TableCell td        = new TableCell();
                    td.Text = strendti;
                    tr.Cells.Add(td);
                    ////姓名
                    //TableCell td1 = new TableCell();
                    //td1.Text = Session["name"].ToString();
                    //tr.Cells.Add(td1);
                    string  str_sql = "SELECT * FROM [cardinf] where c_id='" + ddl_number.SelectedItem.Text + "'and c_addr='" + ddr_address.SelectedItem.Text + "'and c_time>'" + strendti + "' and c_time<'" + starttime + "' ORDER BY c_time";
                    DataSet ds2 = SqlHelper.ExecuteDataSet(str_sql);
                    int     i1 = ds2.Tables[0].Rows.Count;
                    string  firsttime = "", lastime = "", Tjin = "", Tchu = "";
                    bool    firstcardtime = true;
                    double  T1 = 0, T2 = 0;
                    for (int j = 0; j < i1; j++)
                    {
                        if (ds2.Tables[0].Rows[j]["c_status"].ToString() == "进")
                        {
                            if (firstcardtime)
                            {
                                firsttime = ds2.Tables[0].Rows[j]["c_time"].ToString();

                                firstcardtime = false;
                            }
                            if (j + 1 < i1)
                            {
                                if (ds2.Tables[0].Rows[j + 1]["c_status"].ToString() == "进")
                                {
                                    continue;
                                }
                                else
                                {
                                    Tjin = ds2.Tables[0].Rows[j]["c_time"].ToString();
                                }
                            }
                            else
                            {
                                Tjin = ds2.Tables[0].Rows[j]["c_time"].ToString();
                            }
                        }
                        else
                        if (ds2.Tables[0].Rows[j]["c_status"].ToString() == "出")
                        {
                            if (j + 1 < i1)
                            {
                                if (ds2.Tables[0].Rows[j + 1]["c_status"].ToString() == "出")
                                {
                                    continue;
                                }
                                else
                                {
                                    Tchu = ds2.Tables[0].Rows[j]["c_time"].ToString();
                                }
                            }
                            else
                            {
                                Tchu = ds2.Tables[0].Rows[j]["c_time"].ToString();
                            }
                            lastime = ds2.Tables[0].Rows[j]["c_time"].ToString();
                        }
                        //累计在岗时间


                        if (Tjin != "" && Tchu != "")
                        {
                            DateTime time11 = Convert.ToDateTime(Tjin);
                            DateTime time21 = Convert.ToDateTime(Tchu);
                            if (time21 > time11)
                            {
                                System.TimeSpan ND11 = time21 - time11;
                                T1 += (double)ND11.TotalSeconds / (60 * 60);   //秒数差
                            }
                        }
                        if (Tjin != "" && Tchu != "")
                        {
                            DateTime time12 = Convert.ToDateTime(Tjin);
                            DateTime time22 = Convert.ToDateTime(Tchu);
                            if (time22 < time12)
                            {
                                System.TimeSpan ND22 = time12 - time22;
                                T2 += (double)ND22.TotalSeconds / (60 * 60);   //秒数差
                            }
                        }
                    }
                    //到岗时间
                    TableCell td2 = new TableCell();
                    td2.Text = firsttime;
                    tr.Cells.Add(td2);
                    //最后一次刷卡时间
                    TableCell td_last = new TableCell();
                    td_last.Text = lastime;
                    tr.Cells.Add(td_last);
                    //累计在岗
                    double    T3           = 0;
                    TableCell td3          = new TableCell();
                    string    nowtime2     = DateTime.Now.ToString("yyyy-MM-dd");
                    DateTime  timenowtime2 = Convert.ToDateTime(nowtime2);
                    DateTime  strendtime2  = Convert.ToDateTime(strendti);
                    DateTime  time8        = Convert.ToDateTime(strendti + " " + gettime4);//下午下班时间6:00
                    if (firsttime != "")
                    {
                        DateTime time5 = Convert.ToDateTime(strendti + " " + gettime2); //上午下班时间11:45
                        DateTime time4 = Convert.ToDateTime(strendti + " " + gettime3); //下午上班时间12:45

                        DateTime time9 = Convert.ToDateTime(strendti + " " + gettime5); //晚上上班班时间6:30
                        DateTime time6 = Convert.ToDateTime(firsttime);                 //第一次刷卡时间

                        System.TimeSpan ND1    = time4 - time5;                         //中午午休时间
                        double          wuxiu  = (double)ND1.TotalSeconds / (60 * 60);  //秒数差
                        System.TimeSpan ND2    = time9 - time8;                         //下午晚休时间
                        double          wanxiu = (double)ND2.TotalSeconds / (60 * 60);  //秒数差

                        string   nowtim3 = DateTime.Now.ToString();
                        DateTime time3   = Convert.ToDateTime(nowtim3);       //当前时间
                        if (timenowtime2 == strendtime2)                      //如果时间为当前系统的年月日(同当日明细查询)
                        {
                            if (time3 > time8 && lastime != "")               //当前系统的时间大于下午下班时间
                            {
                                DateTime time7 = Convert.ToDateTime(lastime); //最后一次刷卡时间
                                if (time7 > time9)                            //最后一次刷卡时间大于晚上上班时间
                                {
                                    System.TimeSpan ND11 = time7 - time6;     //最后一次刷卡时间-第一次刷卡时间
                                    T3 = (double)ND11.TotalSeconds / (60 * 60) - wuxiu - wanxiu;
                                }
                                if (time7 < time9 && time7 > time4)       //最后一次刷卡时间小于晚上上班时间,大于下午下班时间12:45<time<6:30
                                {
                                    System.TimeSpan ND1c = time7 - time6; //最后一次刷卡时间-第一次刷卡时间
                                    T3 = (double)ND1c.TotalSeconds / (60 * 60) - wuxiu;
                                }
                                if (time7 < time4)//最后一次刷卡时间小于下午上班时间
                                {
                                    System.TimeSpan ND2c = time7 - time6;
                                    T3 = (double)ND2c.TotalSeconds / (60 * 60);
                                }
                            }
                            if (time3 < time8)                            //当前系统时间小于下午下班时间
                            {
                                if (time3 > time4)                        //当前系统大于下午上班时间
                                {
                                    System.TimeSpan ND31 = time3 - time6; //中午午休时间
                                    T3 = (double)ND31.TotalSeconds / (60 * 60) - wuxiu;
                                }
                                if (time3 < time4)
                                {
                                    System.TimeSpan ND41 = time3 - time6;//中午午休时间
                                    T3 = (double)ND41.TotalSeconds / (60 * 60);
                                }
                            }
                        }
                        else if (lastime != "")
                        {
                            DateTime time7 = Convert.ToDateTime(lastime); //最后一次刷卡时间
                            if (time7 > time9)                            //最后一次刷卡时间大于晚上上班时间
                            {
                                System.TimeSpan ND3 = time7 - time6;
                                T3 = (double)ND3.TotalSeconds / (60 * 60) - wuxiu - wanxiu;
                            }
                            if (time7 > time4 && time7 < time9)//最后一次刷卡时间大于下午上班时间小于晚上上班时间
                            {
                                System.TimeSpan ND4 = time7 - time6;
                                T3 = (double)ND4.TotalSeconds / (60 * 60) - wuxiu;
                            }
                            if (time7 < time4)//最后一次刷卡时间小于下午上班时间
                            {
                                System.TimeSpan ND5 = time7 - time6;
                                T3 = (double)ND5.TotalSeconds / (60 * 60);
                            }
                        }
                    }
                    if (T3 < 0)
                    {
                        T3 = 0;
                    }

                    td3.Text = T3.ToString("f2");
                    tr.Cells.Add(td3);
                    TADD1 += double.Parse(td3.Text);//累加
                    //累计上岗时间
                    TableCell td4 = new TableCell();
                    td4.Text = T1.ToString("f2");
                    tr.Cells.Add(td4);
                    TADD2 += double.Parse(td4.Text);//累计
                    //累计离岗
                    TableCell td5 = new TableCell();
                    td5.Text = T2.ToString("f2");
                    tr.Cells.Add(td5);

                    TADD3 += double.Parse(td5.Text);//累加
                    TableCell td6 = new TableCell();
                    TableCell td7 = new TableCell();
                    TableCell td8 = new TableCell();

                    double T4 = 0;                 //累计加班
                    string canbu = "", chebu = ""; //餐补,车补

                    if (firsttime != "" && lastime != "")
                    {
                        DateTime timelast   = Convert.ToDateTime(lastime);                   //最后一次刷卡时间
                        DateTime timewanban = Convert.ToDateTime(strendti + " " + gettime5); //加班时间
                        if (timelast > timewanban)
                        {
                            System.TimeSpan ND4 = timelast - timewanban;//中午午休时间
                            T4 = (double)ND4.TotalSeconds / (60 * 60);
                        }
                        DateTime timecanbu = Convert.ToDateTime(strendti + " " + getcanbu); //餐补时间
                        DateTime timechebu = Convert.ToDateTime(strendti + " " + getchebu); //车补时间
                        String   sql_canbu = "SELECT * FROM [userinfo] where number='" + ddl_number.SelectedItem.Text + "'";
                        using (SqlDataReader dr_canbu = SqlHelper.ExecuteReader(CommandType.Text, sql_canbu))
                        {
                            if (dr_canbu.Read())
                            {
                                if (dr_canbu["canbu"] != System.DBNull.Value)
                                {
                                    canbu = dr_canbu.GetString(dr_canbu.GetOrdinal("canbu"));
                                }
                                if (dr_canbu["chebu"] != System.DBNull.Value)
                                {
                                    chebu = dr_canbu.GetString(dr_canbu.GetOrdinal("chebu"));
                                }
                            }
                            SqlHelper.Close();
                        }
                        if (timelast < timecanbu)
                        {
                            canbu = "";
                        }
                        if (timelast < timechebu)
                        {
                            chebu = "";
                        }
                    }
                    td6.Text = T4.ToString("f2");;
                    tr.Cells.Add(td6);
                    TADD4 += double.Parse(td6.Text);//累加
                    //餐补
                    td7.Text = canbu;
                    tr.Cells.Add(td7);
                    if (canbu != "")
                    {
                        CANADD += double.Parse(canbu);
                    }
                    //车补

                    td8.Text = chebu;
                    tr.Cells.Add(td8);
                    if (chebu != "")
                    {
                        CHEADD += double.Parse(chebu);
                    }
                    //缺勤
                    TableCell td9 = new TableCell();
                    //判断是否是工作日
                    bool     gongzuoritf = false;
                    string[] sArray      = strendti.Split('-');
                    string   nianfen     = sArray[0] + "-" + sArray[1];

                    DateTime       t           = Convert.ToDateTime(strendti);;
                    String         sql_gongzuo = "SELECT * FROM [gongzuori] where YearMon='" + nianfen + "'";
                    SqlParameter[] sps_gongzuo = new SqlParameter[]
                    {
                        new SqlParameter("@number", ddr_banci.SelectedItem.Text),
                    };
                    using (SqlDataReader dr_gongzuo = SqlHelper.ExecuteReader(CommandType.Text, sql_gongzuo, sps_gongzuo))
                    {
                        string getnianfen = "";

                        if (dr_gongzuo.Read())
                        {
                            getnianfen = dr_gongzuo.GetString(dr_gongzuo.GetOrdinal("gongzuodate"));


                            getnianfen = getnianfen.Replace("\n", string.Empty).Replace("\r", string.Empty);


                            string[] str_getnianfen = getnianfen.Split(',');
                            foreach (string _s in str_getnianfen)
                            {
                                if (strendti == _s)
                                {
                                    gongzuoritf = true;
                                    break;
                                }
                            }

                            SqlHelper.Close();
                        }
                    }
                    //获取请假记录
                    string qingjiashixiang = "";
                    bool   kaoqinbool      = false;

                    string Fen1 = "", Fen2 = "";//请假打分、出勤打分(迟到、早退、旷工)
                    String sql_qingjia = "SELECT * FROM [qingjia] where q_number='" + ddl_number.SelectedItem.Text + "' and q_enddate>='" + strendti + " " + gettime1 + "' and q_startdate<='" + strendti + " " + gettime4 + "' and q_statue='4'";
                    using (SqlDataReader dr_qingjia = SqlHelper.ExecuteReader(CommandType.Text, sql_qingjia))
                    {
                        if (dr_qingjia.Read())
                        {
                            qingjiashixiang = dr_qingjia.GetString(dr_qingjia.GetOrdinal("q_shixiang"));
                            kaoqinbool      = true;
                            if (qingjiashixiang == "事假")
                            {
                                Fen1 = getshijia;
                            }
                            if (qingjiashixiang == "临时假")
                            {
                                Fen1 = getlinshijia;
                            }
                            if (qingjiashixiang == "年假")
                            {
                                Fen1 = getnianxiu;
                            }
                            if (qingjiashixiang == "病假")
                            {
                                Fen1 = getbingjia;
                            }
                            SqlHelper.Close();
                        }
                        else
                        if (firsttime == "")
                        {
                            if (timenowtime2 < strendtime2)
                            {
                                qingjiashixiang = "暂未记录";
                            }
                            else
                            {
                                if (!gongzuoritf)
                                {
                                    qingjiashixiang = "休假";
                                }
                                else
                                {
                                    qingjiashixiang = "旷工";
                                }
                            }
                        }
                        SqlHelper.Close();
                    }
                    td9.Text = qingjiashixiang;
                    tr.Cells.Add(td9);
                    //状态
                    TableCell td10 = new TableCell();
                    td10.Text = " ";
                    if (timenowtime2 < strendtime2)
                    {
                        td10.Text = "暂未记录";
                    }
                    else if (!kaoqinbool && gongzuoritf)
                    {
                        if (qingjiashixiang == "休假")
                        {
                            td10.Text = "";
                        }
                        else if (firsttime != "")
                        {
                            int Intgetchidao = int.Parse(getchidao) * 60;                   //迟到时间范围
                            int Intgetzaot   = int.Parse(getzaotiu) * 60;                   //早退时间范围
                            int Intgetqueqin = int.Parse(getqueqin) * 60;                   //缺勤时间范围,超过为旷工
                            td10.Text = "";
                            DateTime        DTcardgettime1 = Convert.ToDateTime(firsttime); //获取第一次刷卡时间
                            string          kaoqintime     = strendti + " " + gettime1;     //获取早上考勤时间
                            DateTime        DTkaoqintime   = Convert.ToDateTime(kaoqintime);
                            System.TimeSpan NDkaoqin       = DTcardgettime1 - DTkaoqintime; //早上考勤
                            int             nTSeconds      = (int)NDkaoqin.TotalSeconds;    //秒数差



                            if (DTcardgettime1 > DTkaoqintime) //第一次刷卡时间大于早上考勤时间
                            {
                                if (nTSeconds <= Intgetchidao) //迟到时间小于等于迟到考勤时间范围
                                {
                                    td10.Text = "正常,";
                                }
                                else
                                if (nTSeconds >= Intgetchidao && nTSeconds <= Intgetqueqin)
                                {
                                    td10.Text = "迟到,";

                                    Fen2 = getligang;
                                }
                                else
                                if (nTSeconds > Intgetqueqin)
                                {
                                    td10.Text = "旷工,";
                                    Fen2      = getkuanggong;
                                }
                            }
                            else
                            {
                                td10.Text = "正常,";
                            }
                            string   getnowtime = DateTime.Now.ToString();
                            DateTime getnowdate = Convert.ToDateTime(getnowtime);//当前时间
                            if (lastime != "" && gongzuoritf)
                            {
                                DateTime        timelast1      = Convert.ToDateTime(lastime);     //最后一次刷卡时间
                                System.TimeSpan NDkaoqinxiawu  = time8 - timelast1;               //下午考勤
                                int             nTSecondsxiawu = (int)NDkaoqinxiawu.TotalSeconds; //秒数差
                                if (timelast1 < time8 && getnowdate > time8)                      //最后一次刷卡时间小于下午下班时间
                                {
                                    if (nTSecondsxiawu <= Intgetzaot)                             //迟到时间小于等于迟到考勤时间范围
                                    {
                                        td10.Text += "正常";
                                    }
                                    else
                                    if (nTSecondsxiawu > Intgetzaot && nTSecondsxiawu <= Intgetqueqin)
                                    {
                                        td10.Text += "早退";
                                        if (Fen2 != getkuanggong && Fen2 == getligang)
                                        {
                                            int intligang = int.Parse(getligang) + int.Parse(getligang);
                                            Fen2 = intligang.ToString();
                                        }
                                        if (Fen2 != getkuanggong && Fen2 != getligang)
                                        {
                                            Fen2 = getligang;
                                        }
                                    }
                                    else
                                    if (nTSecondsxiawu > Intgetqueqin)
                                    {
                                        td10.Text += "旷工";
                                        Fen2       = getkuanggong;
                                    }
                                }
                                if (timelast1 > time8 && getnowdate > time8)
                                {
                                    td10.Text += "正常";
                                }
                                if (DTcardgettime1 <= DTkaoqintime && timelast1 >= time8)
                                {
                                    td10.Text = "正常,正常";
                                }
                                if (getnowdate > time8)
                                {
                                    if (nTSecondsxiawu + nTSeconds > Intgetqueqin)
                                    {
                                        Fen2 = getkuanggong;
                                    }
                                }
                            }
                            else
                            {
                                if (getnowdate > time8)
                                {
                                    td10.Text += "旷工";
                                    Fen2       = getkuanggong;
                                }
                            }
                        }
                        else
                        {
                            td10.Text = "缺勤";
                            Fen2      = getkuanggong;
                        }
                    }


                    tr.Cells.Add(td10);
                    TableCell td11 = new TableCell();
                    int       intfen1 = 0, intfen2 = 0;
                    if (Fen1 != "")
                    {
                        intfen1 = int.Parse(Fen1);
                    }
                    if (Fen2 != "")
                    {
                        intfen2 = int.Parse(Fen2);
                    }
                    int zongfen = intfen1 + intfen2;
                    FADD     += zongfen;
                    td11.Text = zongfen.ToString();
                    tr.Cells.Add(td11);
                    tb_result.Rows.Add(tr);
                }
                TableRow  trZ  = new TableRow();
                TableCell tdZ1 = new TableCell();
                tdZ1.Text = "累加";
                trZ.Cells.Add(tdZ1);
                TableCell tdZ2 = new TableCell();
                tdZ2.Text = "";
                trZ.Cells.Add(tdZ2);
                TableCell tdZ_last = new TableCell();
                tdZ_last.Text = "";
                trZ.Cells.Add(tdZ_last);
                TableCell tdZ3 = new TableCell();
                tdZ3.Text = TADD1.ToString("f2");
                trZ.Cells.Add(tdZ3);
                TableCell tdZ4 = new TableCell();
                tdZ4.Text = TADD2.ToString("f2");
                trZ.Cells.Add(tdZ4);
                TableCell tdZ5 = new TableCell();
                tdZ5.Text = TADD3.ToString("f2");
                trZ.Cells.Add(tdZ5);
                TableCell tdZ6 = new TableCell();
                tdZ6.Text = TADD4.ToString("f2");
                trZ.Cells.Add(tdZ6);
                //餐补
                TableCell tdZ7 = new TableCell();
                tdZ7.Text = CANADD.ToString("f1");
                trZ.Cells.Add(tdZ7);
                TableCell tdZ8 = new TableCell();
                tdZ8.Text = CHEADD.ToString("f1");
                trZ.Cells.Add(tdZ8);
                TableCell tdZ9 = new TableCell();
                tdZ2.Text = "";
                trZ.Cells.Add(tdZ9);
                TableCell tdZ10 = new TableCell();
                tdZ10.Text = "";
                trZ.Cells.Add(tdZ10);
                //考勤分
                TableCell tdZ11 = new TableCell();
                tdZ11.Text = FADD.ToString();
                trZ.Cells.Add(tdZ11);
                tb_result.Rows.Add(trZ);
            }
        }
    }
コード例 #53
0
ファイル: fc32_report.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t = (Table)gv.Controls[0];

            // Adding Cells

            TableCell FileDate = new TableHeaderCell();

            FileDate.Text = "Time";

            row.Cells.Add(FileDate);

            GridViewRow row1 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t1 = (Table)gv.Controls[0];

            // Adding Cells

            TableCell FileDate3 = new TableHeaderCell();

            FileDate3.ColumnSpan = 1;

            row1.Cells.Add(FileDate3);

            TableCell FileDate31 = new TableHeaderCell();

            FileDate31.Text = "From";

            row1.Cells.Add(FileDate31);

            TableCell FileDate32 = new TableHeaderCell();

            FileDate32.Text = "To";

            row1.Cells.Add(FileDate32);

            TableCell FileDate33 = new TableHeaderCell();

            FileDate33.Text = "From";

            row1.Cells.Add(FileDate33);

            TableCell FileDate329 = new TableHeaderCell();

            FileDate329.Text = "To";

            row1.Cells.Add(FileDate329);

            TableCell FileDate326 = new TableHeaderCell();

            FileDate326.Text = "Furnace Oil Pump Pressure";

            row1.Cells.Add(FileDate326);

            TableCell FileDate337 = new TableHeaderCell();

            FileDate337.Text = "Temperature Of Furnace Oil";

            row1.Cells.Add(FileDate337);

            TableCell FileDate327 = new TableHeaderCell();

            FileDate327.Text = "Boiler Steam Pressure";

            row1.Cells.Add(FileDate327);

            TableCell FileDate338 = new TableHeaderCell();

            FileDate338.Text = "Temperature of Oil service tank";

            row1.Cells.Add(FileDate338);

            TableCell FileDate328 = new TableHeaderCell();

            FileDate328.Text = "PH(Water)";

            row1.Cells.Add(FileDate328);

            TableCell FileDate339 = new TableHeaderCell();

            FileDate339.Text = "Water Charges";

            row1.Cells.Add(FileDate339);

            TableCell FileDate340 = new TableHeaderCell();

            FileDate340.Text = "Furanace oil expense";

            row1.Cells.Add(FileDate340);

            TableCell FileDate341 = new TableHeaderCell();

            FileDate341.Text = "Particulars";

            row1.Cells.Add(FileDate341);

            t1.Rows.AddAt(0, row1);

            TableCell cell3 = new TableHeaderCell();

            cell3.ColumnSpan = 2;

            cell3.Text = "Start Time";

            row.Cells.Add(cell3);

            t.Rows.AddAt(0, row);

            TableCell cell4 = new TableHeaderCell();

            cell4.ColumnSpan = 2;
            cell4.Text = "Stop Time";

            row.Cells.Add(cell4);

            t.Rows.AddAt(0, row);

           // TableCell cell6 = new TableHeaderCell();

           // cell6.ColumnSpan = 2;

           // cell6.Text = "Fuel consumed in boiler";

           // row.Cells.Add(cell6);

           // t.Rows.AddAt(0, row);

           // TableCell cell71 = new TableHeaderCell();

           // // cell71.ColumnSpan = 2;

           // cell71.Text = "Indent number";

           // row.Cells.Add(cell71);

           // TableCell cell7 = new TableHeaderCell();

           // cell7.ColumnSpan = 2;

           // cell7.Text = "Signature";

           // row.Cells.Add(cell7);

           // t.Rows.AddAt(0, row);
           // TableCell cell8 = new TableHeaderCell();

           //// cell8.ColumnSpan = 2;
           // cell8.Text = "Remarks";

           // row.Cells.Add(cell8);

            t.Rows.AddAt(0, row);

            t.Rows.AddAt(0, row);

        }
    }
コード例 #54
0
ファイル: ManageChuQin.aspx.cs プロジェクト: Mike-gif/testgit
    protected void moning_Click(object sender, EventArgs e)
    {
        if (Session["number"] == null)
        {
            Response.Write("<script>alert('登录时间过期,请重新登录');window.location='../login.aspx';</script>");
            return;
        }
        if (ddl_number.Text == "")
        {
            // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('')</script>");
            return;
        }

        string gettime1 = "", gettime2 = "", gettime3 = "", gettime4 = "", gettime5 = "", getcanbu = "", getchebu = "", getchidao = "", getzaotiu = "", getqueqin = "";//获取早上考勤时间,允许迟到时间,旷工时间,午休时间,下午下班时间,加班时间
        String sql1 = "SELECT * FROM [KaoQinCanShu] where banci=@number";

        SqlParameter[] sps1 = new SqlParameter[]
        {
            new SqlParameter("@number", ddr_banci.SelectedItem.Text),
        };
        using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql1, sps1))
        {
            if (dr.Read())
            {
                gettime1  = dr.GetString(dr.GetOrdinal("time1"));
                gettime2  = dr.GetString(dr.GetOrdinal("time2"));
                gettime3  = dr.GetString(dr.GetOrdinal("time3"));
                gettime4  = dr.GetString(dr.GetOrdinal("time4"));
                gettime5  = dr.GetString(dr.GetOrdinal("time5"));//晚班时间
                getcanbu  = dr.GetString(dr.GetOrdinal("canbu"));
                getchebu  = dr.GetString(dr.GetOrdinal("chebu"));
                getchidao = dr.GetString(dr.GetOrdinal("chidao"));
                getzaotiu = dr.GetString(dr.GetOrdinal("zaotiu"));
                getqueqin = dr.GetString(dr.GetOrdinal("queqin"));
            }
            SqlHelper.Close();
        }
        TableHeaderRow thr = new TableHeaderRow();

        //构建表头
        // string[] s_th = "员工编号,员工姓名,第一次刷卡(到岗)时间,最后一次刷卡(离岗)时间,累计在岗(小时),累计上岗时间(小时),累计离岗时间(小时),累计加班时间(小时),餐补,车补,缺勤,状态(早、晚)".Split(',');
        string[] s_th = "第一次刷卡(到岗)时间,最后一次刷卡(离岗)时间,累计在岗(小时),累计上岗时间(小时),累计离岗时间(小时),累计加班时间(小时),餐补,车补,缺勤,状态(早、晚)".Split(',');
        foreach (string _s in s_th)
        {
            TableHeaderCell thd = new TableHeaderCell();
            thd.Text = _s;
            thr.Cells.Add(thd);
        }

        tb_result.Rows.Add(thr);

        TableRow tr = new TableRow();

        //员工编号

        /*   TableCell td = new TableCell();
         * td.Text = ddl_number.SelectedItem.Text;
         * tr.Cells.Add(td);
         * //姓名
         * string user_name = "";
         * String sql_name = "SELECT * FROM [userinfo] where number=@number";
         * SqlParameter[] sps_name = new SqlParameter[]
         *             {
         *                 new SqlParameter("@number",ddl_number.SelectedItem.Text),
         *             };
         * using (SqlDataReader dr_name = SqlHelper.ExecuteReader(CommandType.Text, sql_name, sps_name))
         * {
         *
         *     if (dr_name.Read())
         *     {
         *         user_name = dr_name.GetString(dr_name.GetOrdinal("name"));
         *
         *     }
         *     SqlHelper.Close();
         * }
         * TableCell td1 = new TableCell();
         * td1.Text = user_name;
         * tr.Cells.Add(td1);
         */
        string  strendti = DateTime.Now.ToString("yyyy-MM-dd");//获取当前系统时间
        string  endtime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
        string  str_sql = "SELECT * FROM [cardinf] where c_id='" + ddl_number.SelectedItem.Text + "'and c_addr='" + ddr_address.SelectedItem.Text + "' and c_time>'" + strendti + "' and c_time<'" + endtime + "' ORDER BY c_time";
        DataSet ds2 = SqlHelper.ExecuteDataSet(str_sql);
        int     i = ds2.Tables[0].Rows.Count;
        string  firsttime = "", lastime = "", Tjin = "", Tchu = "";
        bool    firstcardtime = true;
        double  T1 = 0, T2 = 0;

        for (int j = 0; j < i; j++)//进出时间累加计算,获得上岗和离岗的时间总和
        {
            if (ds2.Tables[0].Rows[j]["c_status"].ToString() == "进")
            {
                if (firstcardtime)
                {
                    firsttime = ds2.Tables[0].Rows[j]["c_time"].ToString();

                    firstcardtime = false;
                }
                if (j + 1 < i)
                {
                    if (ds2.Tables[0].Rows[j + 1]["c_status"].ToString() == "进")
                    {
                        continue;
                    }
                    else
                    {
                        Tjin = ds2.Tables[0].Rows[j]["c_time"].ToString();
                    }
                }
                else
                {
                    Tjin = ds2.Tables[0].Rows[j]["c_time"].ToString();
                }
            }
            else
            if (ds2.Tables[0].Rows[j]["c_status"].ToString() == "出")
            {
                if (j + 1 < i)
                {
                    if (ds2.Tables[0].Rows[j + 1]["c_status"].ToString() == "出")
                    {
                        continue;
                    }
                    else
                    {
                        Tchu = ds2.Tables[0].Rows[j]["c_time"].ToString();
                    }
                }
                else
                {
                    Tchu = ds2.Tables[0].Rows[j]["c_time"].ToString();
                }
                lastime = ds2.Tables[0].Rows[j]["c_time"].ToString();
            }
            //累计在岗时间
            if (Tjin != "" && Tchu != "")
            {
                DateTime time1 = Convert.ToDateTime(Tjin);
                DateTime time2 = Convert.ToDateTime(Tchu);
                if (time2 > time1)
                {
                    System.TimeSpan ND = time2 - time1;
                    T1 += (double)ND.TotalSeconds / (60 * 60);   //秒数差
                }
            }
            //累计离岗时间
            if (Tjin != "" && Tchu != "")
            {
                DateTime time1 = Convert.ToDateTime(Tjin);
                DateTime time2 = Convert.ToDateTime(Tchu);
                if (time2 < time1)
                {
                    System.TimeSpan ND = time1 - time2;
                    T2 += (double)ND.TotalSeconds / (60 * 60);   //秒数差
                }
            }
        }
        //到岗时间
        TableCell td2 = new TableCell();

        td2.Text = firsttime;
        tr.Cells.Add(td2);
        //最后一次刷卡时间
        TableCell td_last = new TableCell();

        td_last.Text = lastime;
        tr.Cells.Add(td_last);
        //累计在岗
        double    T3    = 0;
        TableCell td3   = new TableCell();
        DateTime  time8 = Convert.ToDateTime(strendti + " " + gettime4);//下午下班时间

        if (firsttime != "")
        {
            string   nowtime2 = DateTime.Now.ToString();
            DateTime time3    = Convert.ToDateTime(nowtime2);                  //当前时间
            DateTime time4    = Convert.ToDateTime(strendti + " " + gettime3); //下午上班时间
            DateTime time5    = Convert.ToDateTime(strendti + " " + gettime2); //上午下班时间

            DateTime time6 = Convert.ToDateTime(firsttime);                    //第一次刷卡时间
            DateTime time9 = Convert.ToDateTime(strendti + " " + gettime5);    //晚上上班班时间6:30

            System.TimeSpan ND1    = time4 - time5;                            //中午午休时间
            double          wuxiu  = (double)ND1.TotalSeconds / (60 * 60);     //秒数差
            System.TimeSpan ND2    = time9 - time8;                            //下午晚休时间
            double          wanxiu = (double)ND2.TotalSeconds / (60 * 60);     //秒数差


            if (time3 > time8 && lastime != "")               //当前系统的时间大于下午下班时间
            {
                DateTime time7 = Convert.ToDateTime(lastime); //最后一次刷卡时间
                if (time7 > time9)                            //最后一次刷卡时间大于晚上上班时间
                {
                    System.TimeSpan ND11 = time7 - time6;     //最后一次刷卡时间-第一次刷卡时间
                    T3 = (double)ND11.TotalSeconds / (60 * 60) - wuxiu - wanxiu;
                }
                if (time7 < time9 && time7 > time4)       //最后一次刷卡时间小于晚上上班时间,大于下午下班时间12:45<time<6:30
                {
                    System.TimeSpan ND1c = time7 - time6; //最后一次刷卡时间-第一次刷卡时间
                    T3 = (double)ND1c.TotalSeconds / (60 * 60) - wuxiu;
                }
                if (time7 < time4)//最后一次刷卡时间小于下午上班时间
                {
                    System.TimeSpan ND2c = time7 - time6;
                    T3 = (double)ND2c.TotalSeconds / (60 * 60);
                }
            }
            if (time3 < time8)                            //当前系统时间小于下午下班时间
            {
                if (time3 > time4)                        //当前系统大于下午上班时间
                {
                    System.TimeSpan ND31 = time3 - time6; //中午午休时间
                    T3 = (double)ND31.TotalSeconds / (60 * 60) - wuxiu;
                }
                if (time3 < time4)                        //当前系统时间小于下午上班时间
                {
                    System.TimeSpan ND41 = time3 - time6; //当前时间-第一次刷卡时间
                    T3 = (double)ND41.TotalSeconds / (60 * 60);
                }
            }
        }
        if (T3 < 0)
        {
            T3 = 0;
        }
        td3.Text = T3.ToString("f2");
        tr.Cells.Add(td3);
        //累计上岗时间

        TableCell td4 = new TableCell();

        td4.Text = T1.ToString("f2");
        tr.Cells.Add(td4);
        //累计离岗

        TableCell td5 = new TableCell();

        td5.Text = T2.ToString("f2");
        tr.Cells.Add(td5);


        TableCell td6 = new TableCell();
        TableCell td7 = new TableCell();
        TableCell td8 = new TableCell();
        double    T4 = 0;                 //累计加班
        string    canbu = "", chebu = ""; //餐补,车补

        if (firsttime != "" && lastime != "")
        {
            DateTime timelast   = Convert.ToDateTime(lastime);                   //最后一次刷卡时间
            DateTime timewanban = Convert.ToDateTime(strendti + " " + gettime5); //加班时间
            if (timelast > timewanban)
            {
                System.TimeSpan ND4 = timelast - timewanban;//中午午休时间
                T4 = (double)ND4.TotalSeconds / (60 * 60);
            }
            DateTime timecanbu = Convert.ToDateTime(strendti + " " + getcanbu); //餐补时间
            DateTime timechebu = Convert.ToDateTime(strendti + " " + getchebu); //车补时间
            String   sql_canbu = "SELECT * FROM [userinfo] where number='" + ddl_number.SelectedItem.Text + "'";
            using (SqlDataReader dr_canbu = SqlHelper.ExecuteReader(CommandType.Text, sql_canbu))
            {
                if (dr_canbu.Read())
                {
                    if (dr_canbu["canbu"] != System.DBNull.Value)
                    {
                        canbu = dr_canbu.GetString(dr_canbu.GetOrdinal("canbu"));
                    }
                    if (dr_canbu["chebu"] != System.DBNull.Value)
                    {
                        chebu = dr_canbu.GetString(dr_canbu.GetOrdinal("chebu"));
                    }
                }
                SqlHelper.Close();
            }
            if (timelast < timecanbu)
            {
                canbu = "";
            }
            if (timelast < timechebu)
            {
                chebu = "";
            }
        }
        td6.Text = T4.ToString("f2");;
        tr.Cells.Add(td6);
        //餐补
        td7.Text = canbu;
        tr.Cells.Add(td7);
        //车补

        td8.Text = chebu;
        tr.Cells.Add(td8);
        //缺勤
        TableCell td9 = new TableCell();
        //判断是否是工作日
        bool   gongzuoritf = false;
        string getnianfen  = "";

        string[] sArray  = strendti.Split('-');
        string   nianfen = sArray[0] + "-" + sArray[1];

        DateTime t           = Convert.ToDateTime(strendti);;
        String   sql_gongzuo = "SELECT * FROM [gongzuori] where YearMon='" + nianfen + "'";

        SqlParameter[] sps_gongzuo = new SqlParameter[]
        {
            new SqlParameter("@number", ddr_banci.SelectedItem.Text),
        };
        using (SqlDataReader dr_gongzuo = SqlHelper.ExecuteReader(CommandType.Text, sql_gongzuo, sps_gongzuo))
        {
            if (dr_gongzuo.Read())
            {
                getnianfen = dr_gongzuo.GetString(dr_gongzuo.GetOrdinal("gongzuodate"));


                getnianfen = getnianfen.Replace("\n", string.Empty).Replace("\r", string.Empty);


                string[] str_getnianfen = getnianfen.Split(',');
                foreach (string _s in str_getnianfen)
                {
                    if (strendti == _s)
                    {
                        gongzuoritf = true;
                        break;
                    }
                }

                SqlHelper.Close();
            }
        }
        //获取请假记录


        string qingjiashixiang = "";
        bool   kaoqinbool      = false;
        String sql_qingjia     = "SELECT * FROM [qingjia] where q_number='" + ddl_number.SelectedItem.Text + "' and q_enddate>='" + strendti + " " + gettime1 + "' and q_startdate<='" + strendti + " " + gettime4 + "' and q_statue='4'";

        using (SqlDataReader dr_qingjia = SqlHelper.ExecuteReader(CommandType.Text, sql_qingjia))
        {
            if (dr_qingjia.Read())
            {
                qingjiashixiang = dr_qingjia.GetString(dr_qingjia.GetOrdinal("q_shixiang"));
                kaoqinbool      = true;
            }
            else
            if (firsttime == "")
            {
                if (!gongzuoritf)
                {
                    qingjiashixiang = "休假";
                }
                else
                {
                    qingjiashixiang = "旷工";
                }
            }
            SqlHelper.Close();
        }
        td9.Text = qingjiashixiang;
        tr.Cells.Add(td9);
        //状态
        TableCell td10 = new TableCell();

        if (!kaoqinbool)
        {
            if (firsttime != "" && gongzuoritf)
            {
                int Intgetchidao = int.Parse(getchidao) * 60;                   //迟到时间范围
                int Intgetzaot   = int.Parse(getzaotiu) * 60;                   //早退时间范围
                int Intgetqueqin = int.Parse(getqueqin) * 60;                   //缺勤时间范围,超过为旷工
                td10.Text = "";
                DateTime        DTcardgettime1 = Convert.ToDateTime(firsttime); //获取第一次刷卡时间
                string          kaoqintime     = strendti + " " + gettime1;     //获取早上考勤时间
                DateTime        DTkaoqintime   = Convert.ToDateTime(kaoqintime);
                System.TimeSpan NDkaoqin       = DTcardgettime1 - DTkaoqintime; //早上考勤
                int             nTSeconds      = (int)NDkaoqin.TotalSeconds;    //秒数差



                if (DTcardgettime1 > DTkaoqintime) //第一次刷卡时间大于早上考勤时间
                {
                    if (nTSeconds <= Intgetchidao) //迟到时间小于等于迟到考勤时间范围
                    {
                        td10.Text = "正常,";
                    }
                    else
                    if (nTSeconds >= Intgetchidao && nTSeconds <= Intgetqueqin)
                    {
                        td10.Text = "迟到,";
                    }
                    else
                    if (nTSeconds > Intgetqueqin)
                    {
                        td10.Text = "旷工,";
                    }
                }
                else
                {
                    td10.Text = "正常,";
                }
                string   getnowtime = DateTime.Now.ToString();
                DateTime getnowdate = Convert.ToDateTime(getnowtime);//当前时间
                if (lastime != "")
                {
                    DateTime        timelast1      = Convert.ToDateTime(lastime);     //最后一次刷卡时间
                    System.TimeSpan NDkaoqinxiawu  = time8 - timelast1;               //下午考勤
                    int             nTSecondsxiawu = (int)NDkaoqinxiawu.TotalSeconds; //秒数差
                    if (timelast1 < time8 && getnowdate > time8)                      //最后一次刷卡时间小于下午下班时间
                    {
                        if (nTSecondsxiawu <= Intgetzaot)                             //迟到时间小于等于迟到考勤时间范围
                        {
                            td10.Text += "正常";
                        }
                        else
                        if (nTSecondsxiawu > Intgetzaot && nTSecondsxiawu <= Intgetqueqin)
                        {
                            td10.Text += "早退";
                        }
                        else
                        if (nTSecondsxiawu > Intgetqueqin)
                        {
                            td10.Text += "旷工";
                        }
                    }
                    if (DTcardgettime1 <= DTkaoqintime && timelast1 >= time8)
                    {
                        td10.Text = "正常,正常";
                    }
                    if (timelast1 > time8 && getnowdate > time8)
                    {
                        td10.Text += "正常";
                    }
                }
                //if (nTSecondsxiawu + nTSeconds > Intgetqueqin)
                //{
                //    td10.Text = "旷工";
                //}
            }
            else
            {
                if (td9.Text == "休假")
                {
                    td10.Text = "";
                }
                else
                {
                    td10.Text = "旷工";
                }
            }
        }
        else
        {
            td10.Text = "";
        }

        tr.Cells.Add(td10);
        tb_result.Rows.Add(tr);
    }
    public Table[] vratiTabelaProizvodiPopust(OracleDataReader drO)
    {
        int i = 1;
        int j = 0;
        int pat = 1;
        Table[] nova = new Table[100];
        TableHeaderCell head;
        TableCell cel;
        TableRow row = new TableRow();
        TableFooterRow foot;


        nova[j] = new Table();
        while (drO.Read())
        {
            if (pat == 1)
            {
                //nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Тип_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Данок_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "ЦенаНаб";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Попуст";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
                pat = 2;

            }
            if (i > 10)
            {
                i = 1;
                j++;
                row = new TableRow();
                nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Тип_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "ЦенаНаб";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Попуст";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
            }
            row = new TableRow();
            cel = new TableCell();
            cel.Text = i.ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDP"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDT"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDD"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Име"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Група"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Данок"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["ЦенаНаб"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Попуст"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Цена"].ToString();
            row.Controls.Add(cel);
            nova[j].Controls.Add(row);
            i++;
        }
        Table[] kraj = new Table[j + 1];
        if (nova[0].Rows.Count > 0)
        {
            for (int w = 0; w <= j; w++)
            {
                foot = new TableFooterRow();
                cel = new TableCell();
                cel.ColumnSpan = 5;
                for (int q = 1; q <= j + 1; q++)
                {
                    Button kopce = new Button();
                    kopce.ID = q.ToString();
                    kopce.Click += new EventHandler(kopce_Click);
                    kopce.Text = q.ToString();
                    cel.Controls.Add(kopce);
                }
                foot.Controls.Add(cel);
                if (nova[w] != null)
                    nova[w].Rows.Add(foot);
                kraj[w] = nova[w];
            }
        }
        else
        {
            foot = new TableFooterRow();
            cel = new TableCell();
            cel.Text = " Нема податоци";
            cel.BorderColor = System.Drawing.Color.White;
            cel.BorderWidth = Unit.Pixel(2);
            cel.BorderStyle = BorderStyle.Solid;
            foot.Controls.Add(cel);
            nova[0].Rows.Add(foot);
            kraj[0] = nova[0];
        }
        return kraj;
    }
コード例 #56
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["statsViewer"] == null)
        {
            Response.Redirect("svLogin.aspx");
        }

        DataView dvj = (DataView)(sdcjobs.Select(DataSourceSelectArguments.Empty));
        DataView dvc = (DataView)(sdccust.Select(DataSourceSelectArguments.Empty));

        dvc.Sort = "custID";
        string x = Request.QueryString["fstat"].ToString();

        /*if(x=="1")
         * {
         *  TableHeaderCell thc = new TableHeaderCell();
         *  thc.Text = "ENDED ON";
         *  thc.BorderWidth = 1;
         *  foreach (TableHeaderRow thr in tjobs.Rows)
         *      thr.Cells.Add(thc);
         * }
         * else
         * {
         *  TableHeaderCell thc = new TableHeaderCell();
         *  thc.Text = "CURRENT PHASE";
         *  thc.BorderWidth = 1;
         *  foreach (TableHeaderRow thr in tjobs.Rows)
         *      thr.Cells.Add(thc);
         * }*/
        TableHeaderCell TableHeaderDetails = new TableHeaderCell();

        TableHeaderDetails.Text        = "DETAILS";
        TableHeaderDetails.BorderWidth = 1;
        tjobs.Rows[0].Cells.Add(TableHeaderDetails);
        for (int i = 0; i < dvj.Table.Rows.Count; i++)
        {
            if (dvj.Table.Rows[i]["over"].ToString() == x)
            {
                TableRow tr = new TableRow();

                TableCell tc1 = new TableCell();
                tc1.Text = dvj.Table.Rows[i]["jobID"].ToString();
                tr.Cells.Add(tc1);
                TableCell  tc2 = new TableCell();
                LinkButton lb2 = new LinkButton();
                lb2.Text = dvj.Table.Rows[i]["machineID"].ToString();
                tc2.Controls.Add(lb2);
                Session["bu"]   = "svJobs.aspx?fstat=0";
                lb2.PostBackUrl = "jobProgress.aspx?mid=" + lb2.Text + "&jid=" + tc1.Text;
                tr.Cells.Add(tc2);
                TableCell  tc3 = new TableCell();
                LinkButton lb3 = new LinkButton();
                lb3.Text = dvc.Table.Rows[dvc.Find(dvj.Table.Rows[i]["customerID"])]["custName"].ToString();
                tc3.Controls.Add(lb3);
                lb3.PostBackUrl = "custDesc.aspx?cid=" + dvc.Table.Rows[dvc.Find(dvj.Table.Rows[i]["customerID"])]["custID"].ToString();;
                tr.Cells.Add(tc3);
                TableCell tc4 = new TableCell();
                tc4.Text = (Convert.ToDateTime(dvj.Table.Rows[i]["startdate"])).ToShortDateString();
                tr.Cells.Add(tc4);
                //TableCell tc5 = new TableCell();
                //tc5.BackColor = System.Drawing.Color.Green;
                //tr.Cells.Add(tc5);
                //TableCell tc6 = new TableCell();
                //tr.Cells.Add(tc6);

                tc1.BorderWidth = 1;
                tc2.BorderWidth = 1;
                tc3.BorderWidth = 1;
                tc4.BorderWidth = 1;
                //tc5.BorderWidth = 1;
                //tc6.BorderWidth = 1;

                /*if (x=="0")
                 * {
                 *  TableCell c = new TableCell();
                 *  c.Text =dvj.Table.Rows[i]["currentPhaseID"].ToString();
                 *  tr.Cells.Add(c);
                 *  c.BorderWidth = 1;
                 * }
                 * else
                 * {
                 *  TableCell c = new TableCell();
                 *  c.Text = (Convert.ToDateTime(dvj.Table.Rows[i]["enddate"])).ToShortDateString();
                 *  tr.Cells.Add(c);
                 *  c.BorderWidth = 1;
                 * }*/

                TableCell tc7 = new TableCell();
                Button    b   = new Button();
                b.ID       = tc1.Text;
                b.Text     = "VIEW DETAILS";
                b.Click   += B_Click;
                b.CssClass = "btn btn-default";
                tc7.Controls.Add(b);
                tr.Cells.Add(tc7);
                tc7.BorderWidth = 1;

                tjobs.Rows.Add(tr);
            }
        }

        foreach (TableRow tr in tjobs.Rows)
        {
            foreach (TableCell tc in tr.Cells)
            {
                tc.Attributes.CssStyle.Add("text-align", "center");
            }
        }
    }
    public Table[] vratiTabelaNaracka(OracleDataReader drO)
    {
        int i = 1;
        int j = 0;
        int pat = 1;
        int vkupno = 0;
        Table[] nova = new Table[100];
        TableHeaderCell head;
        TableCell cel;
        TableRow row = new TableRow();
        TableFooterRow foot;
        nova[j] = new Table();
        while (drO.Read())
        {
            if (pat == 1)
            {
                //nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Тип_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Attributes.Add("class", "hide");
                head.Text = "Данок_ID";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Колинчина";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Потврди";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
                pat = 2;

            }
            if (i > 10)
            {
                i = 1;
                j++;
                row = new TableRow();
                nova[j] = new Table();
                head = new TableHeaderCell();
                head.Text = "Бр";
                head.Attributes.Add("class", "hide");
                head = new TableHeaderCell();
                head.Text = "Производ_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Тип_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок_ID";
                head.Attributes.Add("class", "hide");
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Име";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Група";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Данок";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Цена";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Колинчина";
                row.Controls.Add(head);
                head = new TableHeaderCell();
                head.Text = "Потврди";
                row.Controls.Add(head);
                nova[j].Controls.Add(row);
            }
            row = new TableRow();
            cel = new TableCell();
            cel.Text = i.ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDP"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDT"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["IDD"].ToString();
            cel.Attributes.Add("class", "hide");
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Име"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Група"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Данок"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Цена"].ToString();
            row.Controls.Add(cel);
            cel = new TableCell();
            cel.Text = drO["Количина"].ToString();
            row.Controls.Add(cel);
            vkupno += Convert.ToInt32(drO["Количина"].ToString()) * Convert.ToInt32(drO["Цена"].ToString());
            cel = new TableCell();
            Button brisiBtn = new Button();
            brisiBtn.Text = "Избриши";
            brisiBtn.ID = "izbrisiBtn." + j.ToString() + "." + i.ToString();
           // brisiBtn.Click += new EventHandler(brisiBtn_Click);
            brisiBtn.Click += delKopce;
            cel.Controls.Add(brisiBtn);
            row.Controls.Add(cel);
            nova[j].Controls.Add(row);
            i++;
        }
        Table[] kraj = new Table[j + 1];
        if (nova[0].Rows.Count > 0)
        {
            for (int w = 0; w <= j; w++)
            {
                row = new TableRow();
                cel = new TableCell();
                cel.Text = "Вкупно-Нарачка:" + vkupno.ToString() + ".00 ден";
                cel.Attributes.Add("class", "textCellLevo textVkupno");
                row.Controls.Add(cel);
                nova[w].Controls.Add(row);
                foot = new TableFooterRow();
                cel = new TableCell();
                cel.ColumnSpan = 5;
                for (int q = 1; q <= j + 1; q++)
                {
                    Button kopce = new Button();
                    kopce.ID = "." + q.ToString();
                    kopce.Click += new EventHandler(kopceLista_Click);
                    kopce.Text = q.ToString();
                    cel.Controls.Add(kopce);
                }
                foot.Controls.Add(cel);
                if (nova[w] != null)
                    nova[w].Rows.Add(foot);
                kraj[w] = nova[w];
            }
        }
        else
        {
            foot = new TableFooterRow();
            cel = new TableCell();
            cel.Text = " Нарачката е празна ";
            cel.BorderColor = System.Drawing.Color.White;
            cel.BorderWidth = Unit.Pixel(2);
            cel.BorderStyle = BorderStyle.Solid;
            foot.Controls.Add(cel);
            nova[0].Rows.Add(foot);
            kraj[0] = nova[0];
        }
        return kraj;
    }
コード例 #58
0
    }     // End of btn submit method

    // Method to display confirmation page
    protected void displayConfirmationPage(Student studentStat)
    {
        // Make a table for the student in the student list
        foreach (Student student in studentType)
        {
            // Make form contents disappear.
            optionsPage.Visible = false;

            // Display confirmation page
            confirmationPage.Visible = true;

            // Display the student's name that's in the list
            studentName.Text = student.Name;

            // Display the student's status
            studentStatus.Text = student.ToString();

            // Display basic table structure for student
            // Used this source for tables: How to Add Rows and Cells Dynamically to a Table Web Server Control
            // https://msdn.microsoft.com/en-us/library/7bewx260.aspx

            TableHeaderRow tableHeader = new TableHeaderRow();
            courseTable.Rows.Add(tableHeader);

            TableHeaderCell codeHeader = new TableHeaderCell();
            codeHeader.Text = "Course Code";
            tableHeader.Cells.Add(codeHeader);

            TableHeaderCell titleHeader = new TableHeaderCell();
            titleHeader.Text = "Course Title";
            tableHeader.Cells.Add(titleHeader);

            TableHeaderCell hoursHeader = new TableHeaderCell();
            hoursHeader.Text = "Weekly Hours";
            tableHeader.Cells.Add(hoursHeader);

            TableHeaderCell feeHeader = new TableHeaderCell();
            feeHeader.Text = "Fee Payable";
            tableHeader.Cells.Add(feeHeader);

            // For the student in the list, create table content for each course selected
            foreach (Course course in student.getEnrolledCourses())
            {
                // Create a table row
                TableRow tblRow = new TableRow();
                courseTable.Rows.Add(tblRow);

                // Create the row cells
                TableCell cellCode = new TableCell();
                cellCode.Text = course.Code;

                TableCell cellTitle = new TableCell();
                cellTitle.Text = course.Title;

                TableCell cellHours = new TableCell();
                cellHours.Text = course.WeeklyHours.ToString();

                TableCell cellFee = new TableCell();
                cellFee.Text = "$" + course.Fee.ToString();

                // Add course info seperately to each table cell
                tblRow.Cells.Add(cellCode);
                tblRow.Cells.Add(cellTitle);
                tblRow.Cells.Add(cellHours);
                tblRow.Cells.Add(cellFee);
            }

            // Create an additional table row for total hours and fee
            TableRow tblRowTotal = new TableRow();
            courseTable.Rows.Add(tblRowTotal);

            TableCell cellEmpty = new TableCell();
            cellEmpty.Text = "";
            tblRowTotal.Cells.Add(cellEmpty);

            TableCell cellTotalText = new TableCell();
            // Used similar method to align text based on second response on:
            // https://stackoverflow.com/questions/25245839/align-a-label-to-the-right-using-asp-net
            cellTotalText.Attributes.Add("Style", "text-align:right");
            cellTotalText.Text = "Total";
            tblRowTotal.Cells.Add(cellTotalText);

            TableCell cellTotalHours = new TableCell();
            cellTotalHours.Text = student.totalWeeklyHours().ToString();
            tblRowTotal.Cells.Add(cellTotalHours);

            TableCell cellTotalFee = new TableCell();
            cellTotalFee.Text = "$" + student.feePayable().ToString();
            tblRowTotal.Cells.Add(cellTotalFee);
        } // End of studentType list
    }     // End of display confirmation page method
コード例 #59
0
ファイル: report_all.aspx.cs プロジェクト: hpie/hpie
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {



            //GridView gv55 = sender as GridView;
            //GridViewRow row55 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
            //Table t55 = (Table)gv55.Controls[0];
            //TableCell cell55 = new TableHeaderCell();
            //cell55.Text = "Species";
            //cell55.RowSpan = 1;
            //row55.Cells.Add(cell55);

            //t55.Rows.AddAt(0, row55);
          




            GridView gv = sender as GridView;        
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);   
            Table t = (Table)gv.Controls[0];
            TableCell cell1 = new TableHeaderCell();
            cell1.Text = "Species";
            cell1.RowSpan = 1;          
            row.Cells.Add(cell1);
            TableCell cell2 = new TableHeaderCell();
            cell2.Text = "Previous volume sold w.e.f. "+ViewState["dt1"].ToString()+" to "+ViewState["dt2"].ToString();
            row.Cells.Add(cell2);
            cell2.ColumnSpan = 3;
            TableCell cell3 = new TableHeaderCell();
            cell3.Text = "Current volume sold during "+Convert.ToDateTime(ViewState["dt3"]).ToString("MMM-yyyy");
            cell3.ColumnSpan = 3;
            row.Cells.Add(cell3);
            TableCell cell4 = new TableHeaderCell();
            cell4.Text = "Total upto " + ViewState["dt3"].ToString();
            cell4.ColumnSpan = 3;
            row.Cells.Add(cell4);
            TableCell cell5 = new TableHeaderCell();
            cell5.Text = "Previous volume sold w.e.f. " + ViewState["dt4"].ToString() + " to " + ViewState["dt5"].ToString();
            cell5.ColumnSpan = 3;
            row.Cells.Add(cell5);
            TableCell cell6 = new TableHeaderCell();
            cell6.Text = "Current volume sold during " + Convert.ToDateTime(ViewState["dt6"]).ToString("MMM-yyyy");
            cell6.ColumnSpan = 3;
            row.Cells.Add(cell6);
            TableCell cell7 = new TableHeaderCell();
            cell7.Text = "Total upto " + ViewState["dt6"].ToString();
            cell7.ColumnSpan = 3;
            row.Cells.Add(cell7);             
            t.Rows.AddAt(0, row);
            Table t8 = (Table)gv.Controls[0];
        }
     

            bool IsSubTotalRowNeedToAdd = false;
            bool IsGrandTotalRowNeedtoAdd = false;

            bool head_t = false;
            if (DataBinder.Eval(e.Row.DataItem, "categ") == null)
        {
            head_t=true;
        }

            //if (DataBinder.Eval(e.Row.DataItem, "categ") != null && ViewState["chk2"].ToString() != "")
            //{

            //    string chk = DataBinder.Eval(e.Row.DataItem, "categ").ToString();
            //    if (ViewState["chk2"].ToString() != chk)
            //    {
            //        IsSubTotalRowNeedToAdd = true;
            //        ViewState["chk2"] = chk.ToString();

            //    }
            //    else
            //    {
            //        ViewState["chk2"] = chk.ToString();
            //    }

            //}
           
            if ((strPreviousRowID != string.Empty) && (DataBinder.Eval(e.Row.DataItem, "categ") != null))
                if (strPreviousRowID != DataBinder.Eval(e.Row.DataItem, "categ").ToString())
                    IsSubTotalRowNeedToAdd = true;
           
            if ((strPreviousRowID != string.Empty) && (DataBinder.Eval(e.Row.DataItem, "categ") == null))
            {
                IsSubTotalRowNeedToAdd = true;
                IsGrandTotalRowNeedtoAdd = true;
                intSubTotalIndex = 1;
               
            }

            #region Getting the first Group Header Text
            if ((strPreviousRowID == string.Empty) && (DataBinder.Eval(e.Row.DataItem, "categ") != null))
                // Getting the First column text of first group
                strGroupHeaderText = DataBinder.Eval(e.Row.DataItem, "categ").ToString();
            #endregion





            if (IsSubTotalRowNeedToAdd)
            {
              
                #region Adding Sub Total Row
                GridView grdViewOrders = (GridView)sender;

                // Creating a Row
                GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Insert);

                //Adding Total Cell 
                TableCell cell = new TableCell();
                // Displaying the Group Total First Column Text here.
                // This value can be decided when assigning strGroupHeaderText variable value.
               // cell.Text = strGroupHeaderText;
                cell.HorizontalAlign = HorizontalAlign.Right;

                cell.Text = "Total <a href='avascript:showNestedGridView('customerID-<%# Eval("CustomerID") %>');">
                                <img id="imagecustomerID-<%# Eval("CustomerID") %>" alt="Click to show/hide orders" border="0" src="plus.png" />
                            </a>";

                cell.ColumnSpan = 1;
                cell.CssClass = "SubTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Amount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                //Adding Amount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                //Adding Amount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                //Adding Amount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                //Adding Amount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", vol_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", amt_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = string.Format("{0:0.00}", rate_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "SubTotalRowStyle";
                //cell.ColumnSpan = 18;
                row.Cells.Add(cell);

                //Adding the Row at the RowIndex position in the Grid


                if (count555 == 0)
                {
                    grdViewOrders.Controls[0].Controls.AddAt(7, row);
                    count555++;
                    vol_g1 = 0;
                    amt_g1 = 0;
                    rate_g1 = 0;
                    vol_g2 = 0;
                    amt_g2 = 0;
                    rate_g2 = 0;
                    vol_g3 = 0;
                    amt_g3 = 0;
                    rate_g3 = 0;
                    vol_g4 = 0;
                    amt_g4 = 0;
                    rate_g4 = 0;
                    vol_g5 = 0;
                    amt_g5 = 0;
                    rate_g5 = 0;
                    vol_g6 = 0;
                    amt_g6 = 0;
                    rate_g6 = 0;
                }
                else
                {

                    grdViewOrders.Controls[0].Controls.AddAt(e.Row.RowIndex, row);
                    vol_g1 = 0;
                    amt_g1 = 0;
                    rate_g1 = 0;
                    vol_g2 = 0;
                    amt_g2 = 0;
                    rate_g2 = 0;
                    vol_g3 = 0;
                    amt_g3 = 0;
                    rate_g3 = 0;
                    vol_g4 = 0;
                    amt_g4 = 0;
                    rate_g4 = 0;
                    vol_g5 = 0;
                    amt_g5 = 0;
                    rate_g5 = 0;
                    vol_g6 = 0;
                    amt_g6 = 0;
                    rate_g6 = 0;
                }
                intSubTotalIndex++;
               
                #endregion

                #region Getting Next Group Header Details
                if (DataBinder.Eval(e.Row.DataItem, "categ") != null)
                    // Once each group completed, getting the first column text of next group.
                    strGroupHeaderText = DataBinder.Eval(e.Row.DataItem, "categ").ToString();
                #endregion

                #region Reseting the Sub Total Variables
                dblSubTotalUnitPrice = 0;
                dblSubTotalQuantity = 0;
                dblSubTotalDiscount = 0;
                dblSubTotalAmount = 0;
                #endregion
            }
            if (IsGrandTotalRowNeedtoAdd)
            {
                #region Grand Total Row
                GridView grdViewOrders = (GridView)sender;

                // Creating a Row
                GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Insert);

                //Adding Total Cell 
                TableCell cell = new TableCell();
                cell.Text = "Grand Total";
                cell.HorizontalAlign = HorizontalAlign.Right;
                cell.ColumnSpan = 1;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g1);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g2);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);
                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g3);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);
                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g4);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);
                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g5);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);
                //Adding Unit Price Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gvol_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Quantity Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", gamt_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);

                //Adding Discount Column
                cell = new TableCell();
                cell.Text = string.Format("{0:0.000}", grate_g6);
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.CssClass = "GrandTotalRowStyle";
                row.Cells.Add(cell);



                //Adding the Row at the RowIndex position in the Grid
                grdViewOrders.Controls[0].Controls.AddAt(e.Row.RowIndex, row);
                count555 = 0;
                #endregion
            }

    }
コード例 #60
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string        exp    = FilterJobs.SelectedValue;
        string        status = FilterStatus.SelectedValue;
        SqlCommand    query;
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString);

        if (exp == "none")
        {
            if (status == "none")
            {
                query = new SqlCommand("Select jID, position as Position, openings as Openings, status as Status, experience as 'Applier Type', CAST(createdOn as VARCHAR(10)) as 'Started From' from [Job] where employerHREmail=@email");
                query.Parameters.AddWithValue("email", Util.GetEmail(Request));
            }
            else
            {
                query = new SqlCommand("Select jID, position as Position, openings as Openings, status as Status, experience as 'Applier Type', CAST(createdOn as VARCHAR(10)) as 'Started From' from [Job] where status=@status and employerHREmail=@email");
                query.Parameters.AddWithValue("status", status);
                query.Parameters.AddWithValue("email", Util.GetEmail(Request));
            }
        }
        else
        {
            if (status == "none")
            {
                query = new SqlCommand("Select jID, position as Position, openings as Openings, status as Status, experience as 'Applier Type', CAST(createdOn as VARCHAR(10)) as 'Started From' from [Job] where experience=@exp and employerHREmail=@email");
                query.Parameters.AddWithValue("email", Util.GetEmail(Request));
                query.Parameters.AddWithValue("exp", exp);
            }
            else
            {
                query = new SqlCommand("Select jID, position as Position, openings as Openings, status as Status, experience as 'Applier Type', CAST(createdOn as VARCHAR(10)) as 'Started From' from [Job] where status=@status and experience=@exp and employerHREmail=@email");
                query.Parameters.AddWithValue("email", Util.GetEmail(Request));
                query.Parameters.AddWithValue("status", status);

                query.Parameters.AddWithValue("exp", exp);
            }
        }
        connection.Open();
        query.Connection = connection;

        SqlDataAdapter adapter   = new SqlDataAdapter(query);
        DataTable      datatable = new DataTable();

        adapter.Fill(datatable);
        DataTable tempTable = new DataTable();

        tempTable = datatable.Copy();

        datatable.Columns.RemoveAt(0);

        JobTable.Rows.Clear();
        TableHeaderCell[] ExtraCells = new TableHeaderCell[1];
        TableHeaderCell   viewCell   = new TableHeaderCell();

        viewCell.Text  = "View";
        viewCell.Scope = TableHeaderScope.Column;

        ExtraCells[0] = viewCell;
        Util.AddTableHeaders(JobTable, datatable, ExtraCells);

        for (int i = 0; i < datatable.Rows.Count; i++)
        {
            DataRow row = datatable.Rows[i];

            TableRow tableRow = new TableRow();
            tableRow.CssClass = "table-row";
            foreach (DataColumn col in datatable.Columns)
            {
                if (col.ColumnName != "jID")
                {
                    TableCell tempcell = new TableCell();
                    tempcell.Text = row[col].ToString();
                    tableRow.Cells.Add(tempcell);
                }
            }
            HyperLink link = new HyperLink();
            link.Text = "View Details";
            string temp = ConfigurationManager.AppSettings["domain"] + "HRViewJobPosting.aspx?id=" + HttpUtility.UrlEncode(tempTable.Rows[i]["jID"].ToString());
            link.NavigateUrl = temp;

            link.CssClass = "btn btn-primary";
            TableCell cell = new TableCell();
            cell.Controls.Add(link);
            cell.CssClass = "no-search";

            tableRow.Cells.Add(cell);

            JobTable.Rows.Add(tableRow);
        }
    }