Пример #1
0
        public void displayTable()
        {
            string sBoardName = Request["BoardName"];
            string sBoardOrder = Request["OrderBy"];
            iPageSectorPosition = Convert.ToInt16(Request["PageSectorPosition"]);             
            iPageNum = Convert.ToInt16(Request["PageNum"]);
            bool bFlag = Convert.ToBoolean(Request["Flag"]);

            DBSQL db = new DBSQL();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt = db.TSelect(sBoardName, sBoardOrder, bFlag);
            sBoardOrder = null;

            if (bFlag)
                bFlag = false;
            else
                bFlag = true;

            HtmlGenericControl tr = new HtmlGenericControl("tr");
            thead.Controls.Add(tr);

            try
            {
                foreach (DataColumn col in dt.Columns)
                {
                    HtmlGenericControl th = new HtmlGenericControl("th");
                    thead.Controls.Add(th);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    anchor.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&OrderBy=" + col.ColumnName.ToString() + "&Flag=" + bFlag);
                    anchor.InnerText = col.ColumnName.ToString();
                    th.Controls.Add(anchor);
                }

                for(int i=dt.Rows.Count-(iMaxRowLengh*(iPageNum+1));i<dt.Rows.Count-(iMaxRowLengh * iPageNum);i++)
                {
                    if (i < 0)
                        i = 0;

                    HtmlGenericControl tr1 = new HtmlGenericControl("tr");
                    tbody.Controls.Add(tr1);
                    foreach (DataColumn col in dt.Columns)
                    {
                        HtmlGenericControl td = new HtmlGenericControl("td");
                        td.InnerText = dt.Rows[i][col].ToString();
                        tr1.Controls.Add(td);
                    }
                }

                HtmlGenericControl tr2 = new HtmlGenericControl("tr");
                tbody.Controls.Add(tr2);
                HtmlGenericControl td1 = new HtmlGenericControl("td");
                td1.Attributes.Add("colspan", dt.Columns.Count.ToString());
                td1.Attributes.Add("style", "text-align:center");
                tr2.Controls.Add(td1);

                int iTotalNumberofPage;
                if ((dt.Rows.Count % iMaxRowLengh) == 0)
                    iTotalNumberofPage = dt.Rows.Count / iMaxRowLengh;
                else
                    iTotalNumberofPage = dt.Rows.Count / iMaxRowLengh + 1;
                int iStartPage = iPageSectorLengh * iPageSectorPosition;
                int iLastPage = iPageSectorLengh * (iPageSectorPosition + 1);


                if (iPageSectorPosition > 0)
                {
                    HtmlGenericControl anchorHead = new HtmlGenericControl("a");
                    anchorHead.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + (iStartPage - iPageSectorLengh) + "&PageSectorPosition=" + (iPageSectorPosition -1));
                    anchorHead.InnerText = "<< ";
                    td1.Controls.Add(anchorHead);
                }


                for (iPageNum = iStartPage; iPageNum < iLastPage; iPageNum++)
                {
                    if ((iTotalNumberofPage - iPageNum) == 0)
                        break;

                    HtmlGenericControl anchorBody = new HtmlGenericControl("a");
                    anchorBody.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + iPageNum + "&PageSectorPosition=" + iPageSectorPosition);
                    anchorBody.InnerText = (iPageNum + 1) + " ";
                    td1.Controls.Add(anchorBody);
                }

                if ((iTotalNumberofPage - iLastPage) > 0)
                {
                    HtmlGenericControl anchorTail = new HtmlGenericControl("a");
                    anchorTail.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + (iLastPage+1) + "&PageSectorPosition=" + (iPageSectorPosition + 1));
                    anchorTail.InnerText = ">> ";
                    td1.Controls.Add(anchorTail);
                }
            }
            catch (Exception ex)
            {
                Log l = new Log();
                l.ErrorLog("Board Error:" + ex);
            }
            finally
            {

            }
        }
Пример #2
0
 public editVisitCar(DBSQL db)
 {
     InitializeComponent();
     this.dataB = db;
 }
Пример #3
0
 public void Delete(int id)
 {
     DBSQL.Remove(id);
 }
Пример #4
0
        public List <IDAL.VO.RisultatoVO> NewRisultati(List <IDAL.VO.RisultatoVO> data)
        {
            List <IDAL.VO.RisultatoVO> results = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            string table = this.RisultatoTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "ANREIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "aNreIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.MultiInsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null && res.Rows.Count > 0)
                {
                    results = Mappers.RisultatoMapper.AnreMapper(res);
                }
                if (results != null)
                {
                    if (results.Count > 0)
                    {
                        string tmp = "";
                        int    o   = 0;
                        foreach (IDAL.VO.RisultatoVO tmp_ in results)
                        {
                            tmp += tmp_.anreidid.Value.ToString();
                            if (o < results.Count - 1)
                            {
                                tmp += ", ";
                            }
                            o++;
                        }
                        log.Info(string.Format("Inserted {0} new records with IDs: {1}!", LibString.ItemsNumber(results), tmp));
                    }
                }
                else
                {
                    log.Info(string.Format("No records Inserted!"));
                }
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(results);
        }
Пример #5
0
 public void Insert(string data)
 {
     Count++;
     DBSQL.Add(Count, data);
 }