public void RecoveryDataByAction(CallBackAction cAction)
        {
            if (cAction.BackAction == Share.Action.RecoveryAdd)
            {
                DataRow dr    = cAction.Table.Rows[0];
                int     index = bs_Khoa.Find("MAKH", dr.ItemArray[0]);

                if (bs_GiaoVien.Count != 0)
                {
                    MessageBox.Show("Không thể phục hồi khoa. Vì khoa này đã có giáo viên.",
                                    "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                bs_Khoa.RemoveAt(index);
                WriteToDB();
            }
            else if (cAction.BackAction == Share.Action.RecoveryDelete)
            {
                DataView dt = (DataView)bs_Khoa.List;
                dt.Sort = "MAKH";
                if (dt.FindRows(cAction.Table.Rows[0]).Length != 0)
                {
                    MessageBox.Show("Mã môn học đã tồn tại.Vui lòng nhập lại!");
                }
                else
                {
                    DataRow     dr  = cAction.Table.Rows[0];
                    DataRowView drv = (DataRowView)bs_Khoa.AddNew();
                    drv.Row.ItemArray = dr.ItemArray;
                    WriteToDB();
                }
            }
            else if (cAction.BackAction == Share.Action.RecoveryEdit)
            {
                DataRow dr = cAction.Table.Rows[0];
                bs_Khoa.Position = bs_Khoa.Find("MAKH", dr.ItemArray[0]);

                DataRowView currentRow = (DataRowView)bs_Khoa.Current;

                currentRow.Row.ItemArray = dr.ItemArray;
                WriteToDB();
            }

            this._callAction.Reset();
            this.Refresh();
        }
コード例 #2
1
ファイル: DataViewTest.cs プロジェクト: ericeil/corefx
 public void TestFindRows()
 {
     DataView TestView = new DataView(_dataTable);
     TestView.Sort = "itemId";
     DataRowView[] Result = TestView.FindRows("item 3");
     Assert.Equal(1, Result.Length);
     Assert.Equal("item 3", Result[0]["itemId"]);
 }
        public bool Edit()
        {
            bool isEmpty = ValidateEmpty();

            if (!isEmpty)
            {
                return(false);
            }

            DataRowView currentRow = (DataRowView)bs_Khoa.Current;

            if (currentRow != null)
            {
                DataView dt = (DataView)bs_Khoa.List;
                dt.Sort = "MAKH";
                DataRowView[] rowsFound = dt.FindRows(txt_CodeDepartment.Text.Trim());

                bool isExists = false;
                if (rowsFound.Length != 0)
                {
                    IEnumerable <DataRowView> exists = rowsFound.Where(x => x.Row.ItemArray[0].ToString().Trim().Equals(currentRow.Row.ItemArray[0].ToString().Trim()));
                    isExists = exists.ToList().Count == 0;
                }

                if (isExists)
                {
                    ErrorHandler.ShowError(lbl_Error_CodeDepart, new string[] { "Ox1001" });
                    this.ActiveControl = this.txt_CodeDepartment;
                    return(false);
                }
                else
                {
                    this._callAction.FillData(Share.Action.RecoveryEdit, SetUpCurrentData(currentRow.Row.ItemArray));

                    object[] data = new object[] { txt_CodeDepartment.Text, txt_NameDepartment.Text };
                    currentRow.Row.ItemArray = data;

                    return(true);
                }
            }
            else
            {
                XtraMessageBox.Show(StringLibrary.E_EditEmpty, StringLibrary.E_EditNotify, MessageBoxButtons.OK);
                return(false);
            }
        }
コード例 #4
0
        private static Decimal SumAmounts(DataView AGiftDetailViewByTransactionNumber,
                                          Int32 AGiftTransactionNumber)
        {
            Decimal Result = 0.0m;

            DataRowView[] detailsOfGift = AGiftDetailViewByTransactionNumber.FindRows(
                new object[] { AGiftTransactionNumber });

            foreach (DataRowView rv in detailsOfGift)
            {
                BankImportTDSAGiftDetailRow detailrow = (BankImportTDSAGiftDetailRow)rv.Row;

                Result += detailrow.GiftTransactionAmount;
            }

            return(Result);
        }
コード例 #5
0
    protected void CargarArbolLocalizaciones()
    {
        ArbolLocalizaciones.Nodes.Clear();

        TreeNode Raiz = new TreeNode("TrustAnalytics.");

        Raiz.NavigateUrl = "";
        Raiz.Value       = "Raiz";
        ArbolLocalizaciones.Nodes.Add(Raiz);

        DataView Visor = (DataView)SQLProvincias.Select(DataSourceSelectArguments.Empty);

        Visor.Sort = "Provincia ASC";
        DataView VisorLocalizacion = (DataView)SQLLocalizacionesRegistradas.Select(DataSourceSelectArguments.Empty);
        int      Elementos;

        foreach (DataRowView Fila in Visor)
        {
            TreeNode Nodo = new TreeNode(Fila["Provincia"].ToString());
            Nodo.Value        = "Provincia";
            Nodo.SelectAction = TreeNodeSelectAction.SelectExpand;
            //Nodo.NavigateUrl = "";
            Raiz.ChildNodes.Add(Nodo);

            VisorLocalizacion.Sort = "Provincia ASC";

            Elementos = 0;

            foreach (DataRowView Localizacion in VisorLocalizacion.FindRows(Fila["Provincia"].ToString()))
            {
                Elementos += 1;
                TreeNode NuevoNodo = new TreeNode(Localizacion["Localizacion"].ToString());
                NuevoNodo.Value   = "Localizacion";
                Nodo.SelectAction = TreeNodeSelectAction.SelectExpand;
                Nodo.ChildNodes.Add(NuevoNodo);
            }
            if (Elementos == 0)
            {
                TreeNode NuevoNodo = new TreeNode("<Vacio>");
                NuevoNodo.Value   = "Vacio";
                Nodo.SelectAction = TreeNodeSelectAction.SelectExpand;
                Nodo.ChildNodes.Add(NuevoNodo);
            }
            Nodo.CollapseAll();
        }
    }
コード例 #6
0
ファイル: DataViewTest.cs プロジェクト: pmq20/mono_forked
        public void FindRowsInconsistentKeyLength()
        {
            DataTable dt = new DataTable("table");

            dt.Columns.Add("col1");
            dt.Columns.Add("col2");
            dt.Columns.Add("col3");
            dt.Rows.Add(new object [] { 1, 2, 3 });
            dt.Rows.Add(new object [] { 4, 5, 6 });
            dt.Rows.Add(new object [] { 4, 7, 8 });
            dt.Rows.Add(new object [] { 5, 7, 8 });
            dt.Rows.Add(new object [] { 4, 8, 9 });
            DataView dv = new DataView(dt, null, "col1",
                                       DataViewRowState.CurrentRows);

            dv.FindRows(new object [] { 1, 2, 3 });
        }
コード例 #7
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int workerProfessionID;

            if (!Int32.TryParse(value.ToString(), out workerProfessionID))
            {
                return(null);
            }

            App.BaseClass.GetStaffClass(ref _sc);

            var custView = new DataView(_sc.GetWorkerProfessions().Table, "", "WorkerProfessionID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(workerProfessionID);

            return(!foundRows.Any() ? null : foundRows[0]);
        }
コード例 #8
0
        private string ConvertToWorkerAccessGroup(int workerId)
        {
            var custView = new DataView(_admc.AccessGroupStructureTable, "", "WorkerID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(workerId);

            if (foundRows.Count() != 0)
            {
                var accessGroupId = System.Convert.ToInt32(foundRows[0]["AccessGroupID"]);
                return(ConvertToAccessGroupName(accessGroupId));
            }

            var workerAccess =
                _admc.WorkersAccessTable.AsEnumerable().Where(wA => wA.Field <Int64>("WorkerID") == workerId);

            return(workerAccess.Any() ? "Пользовательская настройка" : "Нет группы");
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: trnka/TMS-FlexCel.NET-demos
        public override object Evaluate(object[] parameters)
        {
            if (parameters == null || parameters.Length != 2)
            {
                throw new ArgumentException("Bad parameter count in call to Orders() user-defined function");
            }

            int Count = OrdersDv.FindRows(parameters).Length;

            if (Count > 0)
            {
                return(Count);
            }
            else
            {
                return(null);
            }
        }
コード例 #10
0
ファイル: MyWorkersClass.cs プロジェクト: gradusina/FA2
        public bool HaveMyWorkers(int mainWorkerID)
        {
            var result = false;

            var custView = new DataView(MyWorkersDataTable, "", "MainWorkerID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(mainWorkerID);

            if (foundRows.Count() != 0)
            {
                result = true;
            }

            custView.Dispose();

            return(result);
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: winxxp/samples
        private void button22_Click(object sender, EventArgs e)
        {
            // <SnippetLDVFromQueryFindRows>
            DataTable products = dataSet.Tables["Product"];

            EnumerableRowCollection <DataRow> query = from product in products.AsEnumerable()
                                                      orderby product.Field <Decimal>("ListPrice"), product.Field <string>("Color")
            select product;

            DataView view     = query.AsDataView();

            view.Sort = "Color";

            object[] criteria = new object[] { "Red" };

            DataRowView[] foundRowsView = view.FindRows(criteria);
            // </SnippetLDVFromQueryFindRows>
        }
コード例 #12
0
    protected void btnEliminarTerritorios_Click(object sender, EventArgs e)
    {
        SeccionNuevoTerritorio.Visible = false;
        txtNuevoTerritorio.Text        = "";
        String strTerritorio;
        String Cadena;


        foreach (int Indice in ListaTerritorios.GetSelectedIndices())
        {
            try
            {
                strTerritorio = ListaTerritorios.Items[Indice].Value;

                DataView Visor = (DataView)SQLProvincias.Select(DataSourceSelectArguments.Empty);
                Visor.Sort = "Territorio ASC";

                String strProvincia;
                foreach (DataRowView Registro in Visor.FindRows(strTerritorio))
                {
                    strProvincia = Registro["Provincia"].ToString();
                    Cadena       = "DELETE FROM Localizacion WHERE (Provicnia = '" + strProvincia + "')";
                    SQLLocalizacionesRegistradas.DeleteCommand = Cadena;
                    SQLLocalizacionesRegistradas.Delete();
                }

                Cadena = "DELETE FROM Provincia WHERE (Territorio = '" + strTerritorio + "')";
                SQLProvincias.DeleteCommand = Cadena;
                SQLProvincias.Delete();

                Cadena = "DELETE FROM Territorio WHERE (Territorio= '" + strTerritorio + "')";
                SQLTerritorios.DeleteCommand = Cadena;
                SQLTerritorios.Delete();
            }
            catch (Exception ex)
            {
            }
        }

        SQLTerritorios.DataBind();
        SQLLocalizacionesRegistradas.DataBind();
        SQLocalizaciones.DataBind();
        SQLProvincias.DataBind();
    }
コード例 #13
0
ファイル: rpdataset.cs プロジェクト: chtheis/reportman.net
 private void UpdateViewRows()
 {
     CurrentRowSet = null;
     if (FViewFilter != null)
     {
         CurrentRowSet = FCurrentView.FindRows(FViewFilter);
         FCurrent      = 0;
         if (CurrentRowSet.Length == 0)
         {
             FEof         = true;
             FInternalEof = true;
         }
         else
         {
             FEof         = false;
             FInternalEof = false;
         }
     }
 }
コード例 #14
0
        public static DataRowView GetSystemCodeRow(DataTable dt, string fields, string values)
        {
            DataView dv     = dt.DefaultView;
            string   filter = dv.RowFilter;
            string   sort   = dv.Sort;

            try
            {
                dv.Sort = fields;
                DataRowView[] drvs = dv.FindRows(values.Split(','));

                return(drvs == null || drvs.Length == 0 ? null : drvs[0]);
            }
            finally
            {
                dv.RowFilter = filter;
                dv.Sort      = sort;
            }
        }
コード例 #15
0
        // not used
        public static ArrayList getChildCats(int catId, ArrayList arrCurrentChilds)
        {
            DataView dv = (DataView)HttpContext.Current.Application["dvvisiblecategoriesorderbyparent"];

            ArrayList arrChilds;

            if (arrCurrentChilds == null)
            {
                arrChilds = new ArrayList();
            }
            else
            {
                arrChilds = arrCurrentChilds;
            }



            DataRowView [] foundrows = dv.FindRows(catId);



            ArrayList arrTmpChilds = new ArrayList();

            foreach (DataRowView row in foundrows)
            {
                Category cat = new Category();
                cat.Id       = Convert.ToInt32(row["CAT_ID"].ToString());
                cat.Name     = row["CAT_NOME"].ToString();
                cat.ParentId = catId;
                arrTmpChilds.Add(cat);
            }



            foreach (Category cat in arrTmpChilds)
            {
                arrChilds.Add(cat);
                getChildCats(cat.Id, arrChilds);
            }

            return(arrChilds);
        }
コード例 #16
0
ファイル: ActionsConverter.cs プロジェクト: gradusina/FA2
        public string GetActionText(int actionId)
        {
            if (_prc == null)
            {
                App.BaseClass.GetProdRoomsClass(ref _prc);
            }

            var custView = new DataView(_prc.Actions.Table, "", "ActionID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(actionId);

            if (foundRows.Any())
            {
                var actionText = foundRows.First()["AtionText"].ToString();
                return(actionText);
            }

            return(string.Empty);
        }
コード例 #17
0
        public string GetLastSealNumber(int lockId)
        {
            if (_prc == null)
            {
                App.BaseClass.GetProdRoomsClass(ref _prc);
            }

            var custView = new DataView(_prc.JournalProductionsTable, "", "LockID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(lockId);

            if (foundRows.Count(r => System.Convert.ToInt32(r["LockStatusID"]) == 2 && r.Row.Field <Boolean>("Visible")) != 0)
            {
                var lastSealNumber = foundRows.Last(r => System.Convert.ToInt32(r["LockStatusID"]) == 2 && r.Row.Field <Boolean>("Visible"))["SealNumber"].ToString();
                return(lastSealNumber);
            }

            return(string.Empty);
        }
コード例 #18
0
        public bool IsLockClosed(int lockId)
        {
            if (_prc == null)
            {
                App.BaseClass.GetProdRoomsClass(ref _prc);
            }

            var custView = new DataView(_prc.JournalProductionsTable, "", "LockID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(lockId);

            if (foundRows.Count(r => r.Row.Field <Boolean>("Visible")) != 0)
            {
                var isClosed = System.Convert.ToBoolean(foundRows.Last(r => r.Row.Field <Boolean>("Visible"))["IsClosed"]);
                return(isClosed);
            }

            return(false);
        }
コード例 #19
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string workOperationName = null;

            App.BaseClass.GetCatalogClass(ref _cc);

            if (_cc != null)
            {
                var custView = new DataView(_cc.WorkOperationsDataTable, "", "WorkOperationID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    workOperationName = foundRows[0].Row["WorkOperationName"].ToString();
                }
            }
            return(workOperationName);
        }
コード例 #20
0
ファイル: ActionsConverter.cs プロジェクト: gradusina/FA2
        public int GetActionNumber(long actionId)
        {
            if (_prc == null)
            {
                App.BaseClass.GetProdRoomsClass(ref _prc);
            }

            var custView = new DataView(_prc.Actions.Table, "", "ActionID",
                                        DataViewRowState.CurrentRows);

            var foundRows = custView.FindRows(actionId);

            if (foundRows.Any())
            {
                var actionNumber = System.Convert.ToInt32(foundRows.First()["ActionNumber"]);
                return(actionNumber);
            }

            return(0);
        }
コード例 #21
0
        public IOpenModuleForm GetOpenFormPro(string MenuNewID)
        {
            string   sOpenType = "1";
            string   sVisible;
            DataView dv = SystemAuthentication.UserAuthorities.DefaultView;

            dv.Sort = "MenuNewID";
            DataRowView[] drv = dv.FindRows(MenuNewID);
            if (drv.Length > 0)
            {
                sVisible = drv[0].Row["MenuVisible"].ToString();
                if (!(sVisible == "1"))
                {
                    return(null);
                }


                FormName     = drv[0].Row["OpenFormClassName"].ToString();
                FormText     = drv[0].Row["MenuText"].ToString();
                FormAssembly = drv[0].Row["OpenAssembly"].ToString();
                FormImage16  = Globals.LoadImage(drv[0].Row["MenuIcon"].ToString(), 16);
                FormImage32  = Globals.LoadImage(drv[0].Row["MenuIcon"].ToString(), 32);
                sOpenType    = drv[0].Row["OpenType"].ToString();
                if (sOpenType == "1")
                {
                    FormOpenType = Common.FormOpenType.MdiOpen;
                }
                else if (sOpenType == "2")
                {
                    FormOpenType = Common.FormOpenType.DiaLogOpen;
                }
                else if (sOpenType == "3")
                {
                    FormOpenType = Common.FormOpenType.DefaultOpen;
                }
                FormTag = MenuNewID;
            }


            return(this);
        }
コード例 #22
0
        /// <summary>
        /// Fill_s the dropdown.
        /// </summary>
        private void Fill_Dropdown()
        {
            IUser     uMgr  = (IUser)ObjectFactory.CreateInstance("BusinessProcess.Security.BUser, BusinessProcess.Security");
            DataTable theDT = uMgr.GetFacilityList();

            uMgr = null;
            ViewState["Facility"] = theDT;
            IQCareUtils theUtils = new IQCareUtils();
            DataView    theDV    = new DataView(theDT);

            theDV.Sort = "FacilityID";
            DataRowView[] drv = theDV.FindRows(Session["AppLocationId"]);
            if (drv[0].Row.ItemArray[2].ToString() == "1")
            {
                theDV.RowFilter = "Preferred = 1";
                DataTable theDT1 = (DataTable)theUtils.CreateTableFromDataView(theDV);
                DataRow   theDR  = theDT1.NewRow();
                theDR["FacilityName"] = "All";
                theDR["FacilityId"]   = 9999;
                theDR["Preferred"]    = 1;
                theDT1.Rows.InsertAt(theDR, 0);
                ddFacility.DataSource     = theDT1;
                ddFacility.DataTextField  = "FacilityName";
                ddFacility.DataValueField = "FacilityId";
                ddFacility.DataBind();
            }
            else
            {
                DataTable theDT1 = (DataTable)theUtils.CreateTableFromDataView(theDV);
                DataRow   theDR  = theDT1.NewRow();
                theDR["FacilityName"] = "All";
                theDR["FacilityId"]   = 9999;
                theDR["Preferred"]    = 0;
                theDT1.Rows.InsertAt(theDR, 0);
                ddFacility.DataSource     = theDT1;
                ddFacility.DataTextField  = "FacilityName";
                ddFacility.DataValueField = "FacilityId";
                ddFacility.DataBind();
            }
            ddFacility.SelectedValue = Session["AppLocationId"].ToString();
        }
コード例 #23
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string accessGroupName = null;

            App.BaseClass.GetAdministrationClass(ref _admc);

            if (_admc != null)
            {
                var custView = new DataView(_admc.AccessGroupsTable, "", "AccessGroupID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    accessGroupName = foundRows[0].Row["AccessGroupName"].ToString();
                }
            }

            return(accessGroupName);
        }
コード例 #24
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string machineName = null;

            App.BaseClass.GetCatalogClass(ref _cc);

            if (_cc != null)
            {
                var custView = new DataView(_cc.MachinesDataTable, "", "MachineID",
                                            DataViewRowState.CurrentRows);

                var foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    machineName = foundRows[0].Row["MachineName"].ToString();
                }
            }

            return(machineName);
        }
コード例 #25
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            App.BaseClass.GetServiceEquipmentClass(ref _sec);

            string requestTypeName = null;

            if (_sec != null)
            {
                var custView = new DataView(_sec.RequestTypes.Table, "", "RequestTypeID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    requestTypeName = foundRows[0].Row["RequestTypeName"].ToString();
                }
            }

            return(requestTypeName);
        }
コード例 #26
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string workerGroupName = string.Empty;

            App.BaseClass.GetStaffClass(ref _sc);

            if (_sc != null)
            {
                var custView = new DataView(_sc.WorkerGroupsDataTable, "", "WorkerGroupID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    workerGroupName = foundRows[0].Row["WorkerGroupName"].ToString();
                }
            }

            return(workerGroupName);
        }
コード例 #27
0
ファイル: IdToContactTypeName.cs プロジェクト: gradusina/FA2
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string     contactTypeName = null;
            StaffClass sc = null;

            App.BaseClass.GetStaffClass(ref sc);

            if (sc != null)
            {
                var custView = new DataView(sc.ContactTypesDataTable, "", "ContactTypeID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    contactTypeName = foundRows[0].Row["ContactTypeName"].ToString();
                }
            }
            return(contactTypeName);
        }
コード例 #28
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string institutionType = null;

            App.BaseClass.GetStaffClass(ref _sc);

            if (_sc != null)
            {
                var custView = new DataView(_sc.EducationInstitutionTypesDataTable, "", "InstitutionTypeID",
                                            DataViewRowState.CurrentRows);

                DataRowView[] foundRows = custView.FindRows(value);

                if (foundRows.Count() != 0)
                {
                    institutionType = foundRows[0].Row["InstitutionTypeName"].ToString();
                }
            }

            return(institutionType);
        }
コード例 #29
0
 private void Grabar()
 {
     if (!BL.UtilDB.ValidarServicioMysql())
     {
         MessageBox.Show("NO SE ACTUALIZARON LOS PRECIOS." + '\r' + "No se pudo conectar con el servidor de base de datos."
                         + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
         tblArticulos.RejectChanges();
         return;
     }
     foreach (DataGridViewRow row in dgvDatos.Rows)
     {
         if (row.Cells["Actualizar"].Value != null)
         {
             if (row.Cells["Actualizar"].Value.ToString() == "1")
             {
                 DataRowView[] foundRows = viewNuevos.FindRows(new object[] { row.Cells["IdArticuloART"].Value.ToString() });
                 foundRows[0].BeginEdit();
                 if (!String.IsNullOrEmpty(txtCosto.Text))
                 {
                     foundRows[0]["PrecioCostoART"] = txtCosto.Text;
                 }
                 if (!String.IsNullOrEmpty(txtPublico.Text))
                 {
                     foundRows[0]["PrecioPublicoART"] = txtPublico.Text;
                 }
                 if (!String.IsNullOrEmpty(txtMayor.Text))
                 {
                     foundRows[0]["PrecioMayorART"] = txtMayor.Text;
                 }
                 foundRows[0].EndEdit();
             }
         }
     }
     if (tblArticulos.GetChanges() != null)
     {
         frmProgress progreso = new frmProgress(tblArticulos, "frmArticulos", "grabar");
         progreso.ShowDialog();
     }
 }
コード例 #30
0
        public void RecoveryDataByAction(CallBackAction cAction)
        {
            if (cAction.BackAction == Share.Action.RecoveryAdd)
            {
                DataRow dr    = cAction.Table.Rows[0];
                int     index = bs_Lop.Find("MALOP", dr.ItemArray[0]);
                bs_Lop.RemoveAt(index);
                SaveClassToDb();
            }
            else if (cAction.BackAction == Share.Action.RecoveryDelete)
            {
                DataView dt = (DataView)bs_Lop.List;
                dt.Sort = "MALOP";
                if (dt.FindRows(cAction.Table.Rows[0]).Length != 0)
                {
                    MessageBox.Show("Mã lớp đã tồn tại.Vui lòng nhập lại!");
                }
                else
                {
                    DataRow     dr  = cAction.Table.Rows[0];
                    DataRowView drv = (DataRowView)bs_Lop.AddNew();
                    drv.Row.ItemArray = dr.ItemArray;
                    SaveClassToDb();
                }
            }
            else if (cAction.BackAction == Share.Action.RecoveryEdit)
            {
                DataRow dr = cAction.Table.Rows[0];
                bs_Lop.Position = bs_Lop.Find("MALOP", dr.ItemArray[0]);

                DataRowView currentRow = (DataRowView)bs_Lop.Current;

                currentRow.Row.ItemArray = dr.ItemArray;
                SaveClassToDb();
            }

            this._callAction.Reset();
            this.Refresh();
        }
コード例 #31
0
        public bool HasWorkerWorkOperationAdmission(long workerId, long workOperationId)
        {
            var workOperationsView = new DataView(_catalogClass.WorkOperationsDataTable, "", "WorkOperationID", DataViewRowState.CurrentRows);
            var foundOperations    = workOperationsView.FindRows(workOperationId);

            if (!foundOperations.Any())
            {
                return(true);
            }

            var operationTypeId = System.Convert.ToInt32(foundOperations.First()["OperationTypeID"]);

            if (operationTypeId != 1)
            {
                return(true);
            }

            var workerWorkOperationAdmissions = _admClass.WorkOperationWorkerAdmissionsTable.AsEnumerable().Where(r => r.Field <Int64>("WorkerID") == workerId &&
                                                                                                                  r.Field <Int64>("WorkOperationID") == workOperationId);

            return(workerWorkOperationAdmissions.Any());
        }
コード例 #32
0
ファイル: DataViewTest2.cs プロジェクト: dotnet/corefx
        public void FindRows_ByKeys()
        {
            DataRowView[] dvArr = null;

            //create the source datatable
            DataTable dt = DataProvider.CreateChildDataTable();

            //create the dataview for the table
            DataView dv = new DataView(dt);

            // FindRows ,no sort - exception
            Assert.Throws<ArgumentException>(() =>
            {
                dvArr = dv.FindRows(new object[] { "3", "3-String1" });
            });

            dv.Sort = "String1,ChildId";
            // Find = wrong sort, can not find
            Assert.Throws<FormatException>(() =>
            {
                dvArr = dv.FindRows(new object[] { "3", "3-String1" });
            });

            dv.Sort = "ChildId,String1";

            //get expected results
            DataRow[] drExpected = dt.Select("ChildId=3 and String1='3-String1'");

            // FindRows - check count
            dvArr = dv.FindRows(new object[] { "3", "3-String1" });
            Assert.Equal(drExpected.Length, dvArr.Length);

            // FindRows - check data

            //check that result is ok
            bool Succeed = true;
            for (int i = 0; i < dvArr.Length; i++)
            {
                Succeed = (int)dvArr[i]["ChildId"] == (int)drExpected[i]["ChildId"];
                if (!Succeed) break;
            }
            Assert.Equal(true, Succeed);
        }
コード例 #33
-1
ファイル: DataViewTest.cs プロジェクト: ericeil/corefx
 public void FindRowsInconsistentKeyLength()
 {
     Assert.Throws<ArgumentException>(() =>
     {
         DataTable dt = new DataTable("table");
         dt.Columns.Add("col1");
         dt.Columns.Add("col2");
         dt.Columns.Add("col3");
         dt.Rows.Add(new object[] { 1, 2, 3 });
         dt.Rows.Add(new object[] { 4, 5, 6 });
         dt.Rows.Add(new object[] { 4, 7, 8 });
         dt.Rows.Add(new object[] { 5, 7, 8 });
         dt.Rows.Add(new object[] { 4, 8, 9 });
         DataView dv = new DataView(dt, null, "col1",
             DataViewRowState.CurrentRows);
         dv.FindRows(new object[] { 1, 2, 3 });
     });
 }