当前位置: 首页>>代码示例>>C#>>正文


C# BindingSource.MoveFirst方法代码示例

本文整理汇总了C#中System.Windows.Forms.BindingSource.MoveFirst方法的典型用法代码示例。如果您正苦于以下问题:C# BindingSource.MoveFirst方法的具体用法?C# BindingSource.MoveFirst怎么用?C# BindingSource.MoveFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.BindingSource的用法示例。


在下文中一共展示了BindingSource.MoveFirst方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Caso

        public Caso(Usuario u)
        {
            InitializeComponent();

            this.u = u;
            cta = new CADINDataSetTableAdapters.CasoTableAdapter();
            ata = new CADINDataSetTableAdapters.ActividadesTableAdapter();
            ata2 = new CADINDataSetTableAdapters.Actividades2TableAdapter();
            eta = new CADINDataSetTableAdapters.EmpresaTableAdapter();

            s1 = new BindingSource();
            s2 = new BindingSource();

            cdt = cta.GetData();
            adt = ata.GetData();

            s1.DataSource = cdt;
            s2.DataSource = adt;
            if (s1.Position != -1)
            {
                txcod_Caso.DataBindings.Add("Text", s1, "cod_caso");
                txCod_empr.DataBindings.Add("Text", s1, "cod_empr");
                txNomb_solic.DataBindings.Add("Text", s1, "pers_solic");
                txCargo.DataBindings.Add("Text", s1, "carg_pers_solic");
                ipFech_soli.DataBindings.Add("Text", s1, "fech_solic");
                txDesc_prob.DataBindings.Add("Text", s1, "desc_soli");

                txDesc_solu.DataBindings.Add("Text", s1, "desc_solu");
                if (s1.Position != -1)
                    sliderNiv_solu.DataBindings.Add("Value", s1, "nive_solu");
                if (s1.Position != -1)
                    ckbCaso_cerr.DataBindings.Add("Checked", s1, "caso_cerrado");

                txObservaciones.DataBindings.Add("Text", s1, "observaciones");
                txCod_resp.DataBindings.Add("Text", s1, "cod_func_asig");
                txResp_Caso.DataBindings.Add("Text", s1, "nomb_func_asig");
                ipFech_solu.DataBindings.Add("Text", s1, "fech_solf");
                dataGridViewX1.DataSource = s2;

                if (u.Admin) {
                    chkbAdm.Visible = true;
                    if (s1.Position != -1)
                     chkbAdm.DataBindings.Add("Checked", s1, "caso_cerrado");
                }
                s1.MoveFirst();
                cargarNE1();
                llenarActividades();
                Cancelar();
            }
            else {
                MessageBox.Show("No hay registros guardados");
                Nuevo();
                }
        }
开发者ID:eduardo-salazar,项目名称:sag,代码行数:54,代码来源:Caso.cs

示例2: NhapDiem

        public NhapDiem(string ChucNang, string MaLop, BangDiem_ThongTin BD)
        {
            InitializeComponent();
            this.ChucNang = ChucNang;
            try
            {
                cbHocKy.DataSource = cls_HocKy.DanhSachHocKy();
                cbHocKy.DisplayMember = "TenHocKy";
                cbHocKy.ValueMember = "MaHocKy";

                cbMonHoc.DataSource = cls_MonHoc.DanhSachMonHoc();
                cbMonHoc.DisplayMember = "TenMonHoc";
                cbMonHoc.ValueMember = "MaMonHoc";
            }
            catch
            {
                MessageBox.Show("Lỗi kết nối, bạn hãy kiểm tra lại.", "Thông báo lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (ChucNang.Equals("F1"))
            {
                try
                {
                    SinhVien_ThongTin SV = new SinhVien_ThongTin();
                    SV.Lop = MaLop;
                    source = new BindingSource();
                    foreach (DataRow Hang in cls_SinhVien.DanhSachSinhVienCuaLop(SV).Rows)
                    source.Add(Hang);

                    //LẤY RA GIÁ TRỊ ĐẦU TIÊN.
                    source.MoveFirst();
                    ShowRecord();
                    XemDiemTheoKySinhVien();
                }
                catch
                {
                    MessageBox.Show("Lỗi kết nối, bạn hãy kiểm tra lại.", "Thông báo lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (ChucNang.Equals("ChinhSua"))
            {
                BangDiemSTT = BD.Stt;
                txtMaSinhVien.Text = BD.MaSinhVien;
                cbHocKy.SelectedValue = BD.MaHocKy;
                cbMonHoc.SelectedValue = BD.MaMonHoc;
                txtDiemQuaTrinh.Text = BD.DiemQuaTrinh.ToString();
                txtDiemThi.Text = BD.DiemThi.ToString();
                ChinhSua = "1";
                XacNhanXoa = "1";
                btXacNhan_QLD.Enabled = false;
                btChinhSua_QLD.Text = "Lưu lại.";
                txtDiemQuaTrinh.Focus();
            }
            txtDiemQuaTrinh.Focus();
        }
开发者ID:chukimmuoi,项目名称:quanlysinhvien_dhxd,代码行数:54,代码来源:NhapDiem.cs

示例3: ExportToExcel

        public void ExportToExcel(BindingSource bs, string fName, string fTitle)
        {
            ProgressBar pb = ((Shedules)Application.OpenForms["Shedules"]).executeProgress;

            DateTime actionDate = new DateTime();
            string eventTitle = String.Empty;
            string headerTitle = String.Empty;
            string groupTitle = String.Empty;
            string headerPhone = String.Empty;
            string contractNum = String.Empty;
            DateTime contractTerm = new DateTime();
            string contractTermStr = String.Empty;
            DatabaseConstant.Bassein_tracks trackID = DatabaseConstant.Bassein_tracks.Default;

            int currEventID;
            DateTime beginTime;
            DateTime endTime;

            Point cursor;
            //смещение времени от начала дня
            TimeSpan timeOffset = new TimeSpan(7, 45, 0);

            try
            {//-------------------------------главный цикл---------------------------------
                bs.MoveFirst();
                ulog.RestartProcessExecInfo(pb);

                foreach (DataRowView item in bs)
                {
                    //счётчик для прогрессбара
                    ulog.ViewProcessExecInfo(pb, Convert.ToInt32((100.0 / bs.Count) * ulog.progressCounter));

                    //текущая дата
                    actionDate = Convert.ToDateTime(Convert.ToString(item["ActionDate"]));
                    int dayOffset = GetOffset(actionDate) * pageSize;
                    currEventID = Convert.ToInt32(item["CurrEventID"]);

                    //получаем время проведения мероприятия
                    beginTime = Convert.ToDateTime(Convert.ToString(item["BeginTime"]));
                    endTime = Convert.ToDateTime(Convert.ToString(item["EndTime"]));

                    DataRow rown = item.Row; //получаем текущие текстовые поля

                    if (rown.IsNull("EventTitle") == false)
                        eventTitle = Convert.ToString(item["EventTitle"]);
                    else
                        eventTitle = string.Empty;

                    if (eventTitle.Contains("354-92-42"))
                        continue;

                    if (rown.IsNull("GroupTitle") == false)
                        groupTitle = Convert.ToString(item["GroupTitle"]);
                    else
                        groupTitle = String.Empty;

                    if (rown.IsNull("HeaderTitle") == false)
                        headerTitle = Convert.ToString(item["HeaderTitle"]);
                    else
                        headerTitle = String.Empty;

                    if (rown.IsNull("HeaderPhone") == false)
                        headerPhone = Convert.ToString(item["HeaderPhone"]);
                    else
                        headerPhone = String.Empty;

                    if (rown.IsNull("ContractNum") == false)
                        contractNum = Convert.ToString(item["ContractNum"]);
                    else
                        contractNum = String.Empty;

                    if (rown.IsNull("ContractTerm") == false)
                    {
                        contractTerm = Convert.ToDateTime(Convert.ToString(item["ContractTerm"]));
                        contractTermStr = contractTerm.ToShortDateString();
                    }
                    else
                        contractTermStr = String.Empty;

                    if (rown.IsNull("TrackID") == false)
                        trackID = (DatabaseConstant.Bassein_tracks)(Convert.ToInt32(item["TrackID"]));
                    else
                        trackID = DatabaseConstant.Bassein_tracks.Default;

                    //описание мероприятия (частичное)
                    string eventDesc = String.Join(" ", groupTitle, headerTitle, headerPhone, contractNum, contractTermStr);
                    //время проведения
                    string eventPeriod = beginTime.ToShortTimeString() + " - " + endTime.ToShortTimeString();
                    //определим, сколько ячеек по вертикали нужно объединить
                    TimeSpan timeDiff = endTime - beginTime;
                    int cellscnt = timeDiff.Hours * 4 + (timeDiff.Minutes / 15);

                    //указатель на позицию вывода
                    cursor = this.GetCursor(trackID);

                    //найдём строку вывода
                    int startline = cursor.Y + (beginTime - timeOffset).Hour * 4 + ((beginTime - timeOffset).Minute / 15) + dayOffset;

                    //объединим ячейки мероприятий
                    MergeCells(startline, cursor.X, startline + cellscnt - 1, cursor.X + using_tracks);
//.........这里部分代码省略.........
开发者ID:hprog,项目名称:exchange,代码行数:101,代码来源:BasseinExport.cs

示例4: EventProcessing

        private void EventProcessing(int colIndex, int rowIndex, BindingSource actualEvents, BindingSource actualActions)
        {
            try
            {
                //запомнить положение скроллбара
                int saveRow = 0;
                if (dgv1.Rows.Count > 0)
                    saveRow = dgv1.FirstDisplayedCell.RowIndex;

                int currEvent = 0;

                //проверка пересечения мероприятий
                string cellTag = Convert.ToString(dgv1[colIndex, rowIndex].Tag);

                if (Int32.TryParse(cellTag, out currEvent))
                {

                    if ((dgv1.collapseEvents.Keys.Contains(currEvent)) && (dgv1[colIndex, rowIndex].Style.BackColor == event_error_bg))
                    {
                        string filter = String.Format("[{0}] IN ({1}, {2})", currEventField, currEvent, dgv1.collapseEvents[currEvent]);
                        CollapseSelect cs = new CollapseSelect(filter, eCategory);

                        if (cs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            currEvent = cs.ReturnEventID();
                        }
                        else
                            return;
                    }

                    actualEvents.Position = actualEvents.Find(currEventField, currEvent);

                    DataRowView curr = (DataRowView)actualEvents.Current;
                    DateTime ebegin = Convert.ToDateTime(Convert.ToString(curr["BeginTime"]));
                    DateTime eend = Convert.ToDateTime(Convert.ToString(curr["EndTime"]));
                    //if (this.EditCurrentEvent(actualEvents, this.eventlistBindingSource, ebegin, eend))
                    //выбираем кейсом eCategory и создаем IEditable;

                    IEditable editEventForm = null;
                    IEditable editActionForm = null;

                    switch (eCategory)
                    {
                        case eventCategory.CurrentEvent:
                            {
                                editEventForm = new EditEventItem(actualEvents, this.eventlistBindingSource, ebegin, eend);
                                editActionForm = new EditActionItem(actualActions, actualEvents, facility_tracksBindingSource,
            groupsBindingSource, group_headersBindingSource);
                            }
                            break;
                        case eventCategory.CalendarEvent:
                            {
                                editEventForm = new EditCalendarEventItem(actualEvents, this.eventlistBindingSource);
                                editActionForm = new EditCalendarActionItem(actualActions, actualEvents, facility_tracksBindingSource,
            groupsBindingSource, group_headersBindingSource);
                            }
                            break;
                        default:
                            editEventForm = null;
                            editActionForm = null;
                            break;
                    }

                    if (this.GenericEditEvent(editEventForm, actualEvents))
                    {
                        SaveChanges();
                        actualActions.MoveFirst();
                        //если есть записи
                        bool isNew = (actualActions.Current == null) ? true : false;

                //        if (this.EditCurrentAction(this.actionsBindingSource, eventsBindingSource, facility_tracksBindingSource,
                //groupsBindingSource, group_headersBindingSource, isNew))
                            if (this.GenericEditAction(editActionForm, this.actionsBindingSource, group_headersBindingSource, isNew))
                            SaveChanges();

                        PrepareSelected();
                        //восстановить положение скроллбара
                        if (saveRow != 0 && saveRow < dgv1.Rows.Count)
                            dgv1.FirstDisplayedScrollingRowIndex = saveRow;
                    }
                }
                else if (cellTag.Equals("new"))
                {
                    DateTime newEventDate = GetCurrentDate(colIndex, dt1.Value);
                    DateTime begin;
                    DateTime end;
                    string btime = String.Format("{0} {1}", currDate.ToShortDateString(), dgv1.Rows[rowIndex].HeaderCell.Value);
                    begin = Convert.ToDateTime(btime);
                    end = begin.AddMinutes(90);

                    Properties.Settings.Default.lastEditEventBeginTime = begin.ToShortTimeString();
                    Properties.Settings.Default.lastEditEventEndTime = end.ToShortTimeString();

                    //if (this.EditCurrentEvent(actualEvents, this.eventlistBindingSource, newEventDate, new DateTime(), true, false))
                    //выбираем кейсом eCategory и создаем IEditable;

                    IEditable editEventForm = null;
                    IEditable editActionForm = null;

                    switch (eCategory)
//.........这里部分代码省略.........
开发者ID:hprog,项目名称:exchange,代码行数:101,代码来源:Plans.cs

示例5: ExportToExcel

        public void ExportToExcel(BindingSource bs, string fName, string fTitle)
        {
            ProgressBar pb = ((Shedules)Application.OpenForms["Shedules"]).executeProgress;
            ulog.RestartProcessExecInfo(pb);

            DateTime actionDate = new DateTime();
            string eventTitle = String.Empty;
            string headerTitle = String.Empty;
            string trackTitle = String.Empty;
            string groupTitle = String.Empty;
            string headerPhone = String.Empty;
            string contractNum = String.Empty;
            string contractTerm = String.Empty;
            int currEventID;
            DateTime beginTime;
            DateTime endTime;

            Point cursor;
            //смещение времени от начала дня
            TimeSpan timeOffset = new TimeSpan(8, 0, 0);

            bs.Sort = "[ActionDate] ASC";
            bs.MoveFirst();

            //page header
            AdjustCells(5, 1, "Работы  " + fTitle + "  МАУ «ЦСП  «Заря»", FontName: "Calibri", FontSize: 14, Halgmnt: Excel.XlHAlign.xlHAlignCenter);

            string exportPeriod = String.Empty;

            //счётчик для прогрессбара

            try
            {
                foreach (DataRowView item in bs)
                {
                    ulog.ViewProcessExecInfo(pb, Convert.ToInt32((100.0 / bs.Count) * ulog.progressCounter));

                    //текущая дата
                    actionDate = Convert.ToDateTime(Convert.ToString(item["ActionDate"]));
                    if (exportPeriod == String.Empty)
                        exportPeriod = actionDate.ToShortDateString();
                    //указатель на позицию начала текущего дня
                    cursor = this.GetCursor(actionDate);

                    //вставить дату рядом с днём недели
                    string dayOfWeek = objSheet.Cells[cursor.Y - 1, cursor.X].Value;
                    if (!dayOfWeek.Contains(actionDate.ToShortDateString()))
                    {
                        AdjustCells(cursor.Y - 1, cursor.X, dayOfWeek + " " + actionDate.ToShortDateString(), FontName: "Calibri",
                            FontSize: 11, FontBold: true, Halgmnt: Excel.XlHAlign.xlHAlignCenter, Valgmnt: Excel.XlVAlign.xlVAlignCenter);
                    }

                    currEventID = Convert.ToInt32(item["CurrEventID"]);

                    //получаем время проведения мероприятия
                    beginTime = Convert.ToDateTime(Convert.ToString(item["BeginTime"]));
                    endTime = Convert.ToDateTime(Convert.ToString(item["EndTime"]));

                    DataRow rown = item.Row; //получаем текущие текстовые поля

                    if (rown.IsNull("EventTitle") == false)
                        eventTitle = Convert.ToString(item["EventTitle"]);

                    if (eventTitle.Contains("354-92-42"))
                        continue;

                    if (rown.IsNull("TrackTitle") == false)
                        trackTitle = Convert.ToString(item["TrackTitle"]);
                    if (rown.IsNull("GroupTitle") == false)
                        groupTitle = Convert.ToString(item["GroupTitle"]);
                    if (rown.IsNull("HeaderTitle") == false)
                        headerTitle = Convert.ToString(item["HeaderTitle"]);
                    if (rown.IsNull("HeaderPhone") == false)
                        headerPhone = Convert.ToString(item["HeaderPhone"]);
                    if (rown.IsNull("ContractNum") == false)
                        contractNum = Convert.ToString(item["ContractNum"]);
                    if (rown.IsNull("ContractTerm") == false)
                        contractTerm = Convert.ToString(item["ContractTerm"]);
                    //описание мероприятия (частичное)
                    string eventDesc = String.Join(" ", trackTitle, groupTitle, headerTitle, headerPhone, contractNum, contractTerm);
                    //время проведения
                    string eventPeriod = beginTime.ToShortTimeString() + " - " + endTime.ToShortTimeString();
                    //определим, сколько ячеек по вертикали нужно объединить
                    TimeSpan timeDiff = endTime - beginTime;
                    int cellscnt = timeDiff.Hours * 4 + (timeDiff.Minutes / 15);

                    //найдём строку вывода
                    int startline = cursor.Y + (beginTime - timeOffset).Hour * 4 + ((beginTime - timeOffset).Minute / 15);
                    //int startline = cursor.Y + (beginTime.Hour - timeOffset.Hours) * 4 + (beginTime.Minute / 15);
                    //объединим ячейки мероприятий
                    MergeCells(startline, cursor.X, startline + cellscnt - 1, cursor.X);
                    //объединим ячейки времени
                    MergeCells(startline, cursor.X - 1, startline + cellscnt - 1, cursor.X - 1);

                    //выводим по полученным индексам "Мероприятие + фио тренера + группа"
                    string celltext = objSheet.Cells[startline, cursor.X].Text;
                    if (celltext.Contains(Convert.ToString(item["EventTitle"])))
                    {
                        AdjustCells(startline, cursor.X, (celltext + " " + eventDesc).Trim(), FontName: "Calibri", FontSize: 8);
                    }
//.........这里部分代码省略.........
开发者ID:hprog,项目名称:exchange,代码行数:101,代码来源:GeneralExport.cs

示例6: initializationInvestProject

 public void initializationInvestProject()
 {
     BindingSource bindingSource = new BindingSource();
     InvestProjectDAO dao = new InvestProjectDAO();
     bindingSource.Clear();
     bindingSource.DataSource = dao.getAll();
     dataGridInvestProject.DataSource = bindingSource;
     bindingSource.CurrentItemChanged += BindingSource_CurrentItemChanged;
     
     if ((ScrollIndex >=0) && (dataGridInvestProject.Rows.Count > 0))
     {
         dataGridInvestProject.FirstDisplayedScrollingRowIndex = ScrollIndex;
     }
     if (BookMarkInvestProject != 0)
     {
         dataGridInvestProject.Rows[BookMarkInvestProject].Selected = true;
         bindingSource.Position = BookMarkInvestProject;
     }
     else
     {
         if (bindingSource.Count > 0)
         {
             bindingSource.MoveNext();
             bindingSource.MoveFirst();
         }
         //dataGridInvestProject.Rows[1].Selected = true;
     }
 }
开发者ID:vladimirmedyannikov,项目名称:ContractTimeSharp,代码行数:28,代码来源:DataGridForm.cs

示例7: ExportToExcel

        public void ExportToExcel(BindingSource bs, string fName, string fTitle)
        {
            xOffset = new Dictionary<int,int>();
            xOffset[100] = 3;
            xOffset[101] = 4;
            xOffset[102] = 5;
            xOffset[103] = 6;
            xOffset[105] = 7;
            xOffset[106] = 8;
            xOffset[107] = 9;
            xOffset[108] = 10;
            xOffset[109] = 11;
            xOffset[110] = 12;
            xOffset[111] = 13;
            xOffset[112] = 14;
            xOffset[113] = 15;
            xOffset[114] = 16;

            try
            {
                P = (Shedules)Application.OpenForms["Shedules"];
                P.executeProgress.Value = 0;
            }
            catch
            { }

            DataRowView reportDataRowView;

            if (bs.Count > 0)
            {
                try
                {
                    //Переходим к первой записи
                    bs.MoveFirst();
                    reportDataRowView = (DataRowView)bs.Current;

                    //определяем текущий месяц
                    DateTime currDate = Convert.ToDateTime(Convert.ToString(reportDataRowView["ActionDate"]).Trim());

                    //Форматируем страницу
                    objSheet.Columns.ColumnWidth = 17;  //ширина столбцов
                    objSheet.Rows.RowHeight = 40;       //высота строк

                    //первая строка
                    objSheet.Cells[1, 1] = months[currDate.Month-1] + " " + currDate.Year.ToString() + " г.";
                    objSheet.Cells[1, 1].WrapText = true;
                    objSheet.Cells[1, 1].Font.Size = 18;
                    objSheet.Cells[1, 1].Font.Name = "Times New Roman";
                    objSheet.Cells[1, 1].Font.Bold = true;
                    MergeCells(1, 1, 1, 2);

                    //вторая строка
                    objSheet.Cells[2, 1] = "Число";
                    objSheet.Cells[2, 1].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    objSheet.Cells[2, 1].VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;

                    objSheet.Cells[2, 2] = "День недели";
                    objSheet.Cells[2, 2].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    objSheet.Cells[2, 2].VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;

                    for(int i = 0; i < 14; ++i)
                    {
                        objSheet.Cells[2, 3 + i] = facilities[i];
                        objSheet.Cells[2, 3 + i].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                        objSheet.Cells[2, 3 + i].VerticalAlignment   = Excel.XlVAlign.xlVAlignCenter;
                        objSheet.Cells[2, 3 + i].WrapText = true;

                    }

                    DateTime d = new DateTime(currDate.Year, currDate.Month, 1);
                    DateTime a = new DateTime(currDate.Year, currDate.Month + 1, 1);

                    int ndays = (a - d).Days;

                    for (int i = 1; i <= ndays; ++i)
                    {
                        objSheet.Cells[2 + i, 1].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                        objSheet.Cells[2 + i, 1].VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
                        objSheet.Cells[2 + i, 1] = i.ToString();
                        objSheet.Cells[2 + i, 2] = days[(int)new DateTime(currDate.Year, currDate.Month, i).DayOfWeek];
                        objSheet.Cells[2 + i, 2].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                        objSheet.Cells[2 + i, 2].VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
                    }

                    int cnt = 1;

                    foreach (DataRowView item in bs)
                    {
                        try
                        {
                            P.executeProgress.Value = Convert.ToInt32((100.0 / bs.Count) * (cnt++));
                        }
                        catch { }

                        DataRow rown = item.Row;

                        string writestr = "";

                        //обязательные поля
                        int dm = Convert.ToInt32(item["DM"]);
//.........这里部分代码省略.........
开发者ID:hprog,项目名称:exchange,代码行数:101,代码来源:SportGraphicExport.cs


注:本文中的System.Windows.Forms.BindingSource.MoveFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。