private void gvGrid_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            if (gvGrid.FocusedRowHandle == GridControl.AutoFilterRowHandle)
            {
                return;
            }

            e.Valid = true;
            if (gvGrid.GetRowCellValue(e.RowHandle, colNHOM_KYTHUAT_ID.FieldName).ToString().Trim().Length == 0)
            {
                gvGrid.SetColumnError(gvGrid.Columns[colNHOM_KYTHUAT_ID.FieldName], colNHOM_KYTHUAT_ID.Caption + " không được phép rỗng.", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Default);
                e.Valid = false;
            }
            if (gvGrid.GetRowCellValue(e.RowHandle, colDIEM_CHUAN.FieldName).ToString().Trim().Length == 0)
            {
                gvGrid.SetColumnError(gvGrid.Columns[colDIEM_CHUAN.FieldName], colDIEM_CHUAN.Caption + " không được phép rỗng.", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Default);
                e.Valid = false;
            }
        }
예제 #2
0
        private void gv_Detail_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            var view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            bool V = true;

            foreach (DevExpress.XtraGrid.Columns.GridColumn column in view.Columns)
            {
                if (Object.Equals(column.Tag, "NotNull"))
                {
                    if (String.IsNullOrEmpty(view.GetFocusedRowCellDisplayText(column)))
                    {
                        view.SetColumnError(column, column.Caption + "不能为空!");
                        V = V & false;
                    }
                }
            }
            e.Valid = V;
        }
        private void gridViewMedicineList_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            var row = gridViewMedicineList.GetFocusedDataRow();

            foreach (GridColumn col in gridViewMedicineList.Columns)
            {
                if (col.ColumnEditName == repositoryItemDelete.Name)
                {
                    continue;
                }
                var a = row[col.FieldName];
                e.ErrorText = medicineBusiness.Validate(row[col.FieldName], col.FieldName);
                if (e.ErrorText != "")
                {
                    e.Valid = false;
                }

                gridViewMedicineList.SetColumnError(col, e.ErrorText);
            }
        }
예제 #4
0
 void stokGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     try
     {
         Stok s = this.stokGridView.GetFocusedRow() as Stok;
         if (s.ID > 0)
         {
             s.GuncellemeTarihi = DateTime.Now;
             if (StokMethods.Update(s) > 0)
             {
                 Commons.Update(TableNames.Stok);
                 Commons.Status("Stokdaki \"" + this.stokGridView.GetFocusedRowCellDisplayText("UrunID") + "\" isimli ürünü bilgisini güncelleme işlemi başarılı bir şekilde gerçekleştirildi!");
             }
         }
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FST", 9) + ex.Message);
     }
 }
예제 #5
0
        private void UIGRIDVIEW_DETA_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            bool           flgvalid = true;
            string         msjerror = "";
            V_INV_DETA_REQ d        = (V_INV_DETA_REQ)e.Row;

            if (d.ID_ARTICULO == 0)
            {
                flgvalid = false;
                msjerror = "Seleccione un articulo";
                UIGRIDVIEW_DETA.SetColumnError(colID_ARTICULO, msjerror);
            }
            if (d.NM_CANTIDAD <= 0)
            {
                flgvalid = false;
                msjerror = "Digite una cantidad correcta";
                UIGRIDVIEW_DETA.SetColumnError(colNM_CANTIDAD, msjerror);
            }
            e.Valid = flgvalid;
        }
예제 #6
0
        private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            for (int i = 2; i < 11; i += 2)
            {
                GridColumn colStock   = gridView1.Columns[i];
                GridColumn colVoucher = gridView1.Columns[i + 1];

                int stockS   = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, colStock));
                int voucherS = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, colVoucher));

                if (stockS > voucherS)
                {
                    //gridView1.SetColumnError(colStock_S, "The Voucher_S value should be less than this value.");
                    //gridView1.SetColumnError(colVoucher_S, "This value should be less than the Units In Stock value.");
                    //gridView1.SetColumnError(null, "Invalid data");
                    e.Valid     = false;
                    e.ErrorText = "'Stock' value should be less than 'Voucher' value guy... :D";
                }
            }
        }
예제 #7
0
        private void UIGRIDVIEW_DETA_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            bool   flgvalid       = true;
            string msjerror       = "";
            CONT_DETA_PART_BORR d = (CONT_DETA_PART_BORR)e.Row;

            if (d.ID_CUENTA == 0)
            {
                flgvalid = false;
                msjerror = "Seleccione una cuenta";
                UIGRIDVIEW_DETA.SetColumnError(colID_CUENTA, msjerror);
            }
            if (d.NM_CARGO > 0 && d.NM_ABONO > 0)
            {
                flgvalid = false;
                msjerror = "Solo puede hacer un movimiento";
                UIGRIDVIEW_DETA.SetColumnError(colNM_CARGO, msjerror);
            }
            e.Valid = flgvalid;
        }
예제 #8
0
 private void aodGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     /*
      * decimal tut = 0;
      * decimal odmMinTut = Convert.ToDecimal(aodGridView.GetRowCellValue(e.RowHandle, colODMMINTUTd));
      * decimal odmMaxTut = Convert.ToDecimal(aodGridView.GetRowCellValue(e.RowHandle, colODMMAXTUTd));
      *
      * if (aodGridView.GetRowCellValue(e.RowHandle, colBRC) != DBNull.Value)
      * {
      *  tut = Convert.ToDecimal(aodGridView.GetRowCellValue(e.RowHandle, colBRC));
      *  if (tut < odmMinTut || tut > odmMaxTut)
      *  {
      *      e.Valid = false;
      *      e.ErrorText = string.Format("Borç tutarında Hata : {0} >= {1} <= {2}\n", odmMinTut, tut, odmMaxTut);
      *  }
      * }
      * if (aodGridView.GetRowCellValue(e.RowHandle, colALC) != DBNull.Value)
      * {
      *  tut = Convert.ToDecimal(aodGridView.GetRowCellValue(e.RowHandle, colALC));
      *  if (tut < odmMinTut || tut > odmMaxTut)
      *  {
      *      e.Valid = false;
      *      e.ErrorText = string.Format("Alacak tutarında Hata : {0} >= {1} <= {2}\n", odmMinTut, tut, odmMaxTut);
      *  }
      * }
      *
      * if (aodGridView.GetRowCellValue(e.RowHandle, colD2BKUR) == DBNull.Value)
      * {
      *  e.Valid = false;
      *  e.ErrorText = "Çapraz Kur girilmemiş\n";
      * }
      * if (aodGridView.GetRowCellValue(e.RowHandle, colD2BKUR) != DBNull.Value)
      * {
      *  tut = Convert.ToDecimal(aodGridView.GetRowCellValue(e.RowHandle, colD2BKUR));
      *  if (tut <= 0)
      *  {
      *      e.Valid = false;
      *      e.ErrorText = "Çapraz kur >= 0 olmalı\n";
      *  }
      * }*/
 }
예제 #9
0
        private void cxGrid1DBTableView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            DataRow drLoc = cxGrid1DBTableView1.GetDataRow(e.RowHandle);

            if (drLoc == null)
            {
                return;
            }

            if (drLoc["LOCATION_CODE"] == DBNull.Value || string.IsNullOrWhiteSpace(Convert.ToString(drLoc["LOCATION_CODE"])))
            {
                XtraMessageBox.Show("Location Code is mandatory.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Valid = false;
                return;
            }
            if (drLoc["LOCATION_NAME"] == DBNull.Value || string.IsNullOrWhiteSpace(Convert.ToString(drLoc["LOCATION_NAME"])))
            {
                XtraMessageBox.Show("Location Name is mandatory.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Valid = false;
                return;
            }

            if (cxGrid1DBTableView1.IsNewItemRow(e.RowHandle) || (!(drLoc["LOCATION_CODE", DataRowVersion.Original]).Equals(drLoc["LOCATION_CODE"])))
            {
                int cnt = oLocationMas.CheckLocationMaster(drLoc["COUNTRY_CODE"].ToString(), drLoc["LOCATION_CODE"].ToString());
                if (cnt > 0)
                {
                    XtraMessageBox.Show("Duplicate Location Code is not allowed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    e.Valid = false;
                    return;
                }
            }

            if (drLoc.RowState == DataRowState.Added)
            {
                drLoc["CREATED_ON"] = DateTime.Now;
            }

            drLoc["CREATED_BY"]   = ProfitCashflow.oPcfDM.UserName;
            drLoc["LAST_UPDATED"] = DateTime.Now;
        }
예제 #10
0
        private void ophLayoutView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            var view = sender as DevExpress.XtraGrid.Views.Layout.LayoutView;

            view.ClearColumnErrors();

            object ROT   = view.GetRowCellValue(e.RowHandle, colROT);
            object MOT   = view.GetRowCellValue(e.RowHandle, colMOT);
            object ACCID = view.GetRowCellValue(e.RowHandle, colACCID);
            object EOH   = view.GetRowCellValue(e.RowHandle, colEOH);

            if (ROT == DBNull.Value)
            {
                view.SetColumnError(colROT, "Boş");
                e.Valid = false;
            }

            if (MOT == DBNull.Value)
            {
                view.SetColumnError(colMOT, "Boş");
                e.Valid = false;
            }

            if (e.Valid && ROT.ToString() == "E" && ACCID == DBNull.Value)
            {
                view.SetColumnError(colACCID, "Boş");
                e.Valid = false;
            }

            if (e.Valid && ROT.ToString() == "E" && view.GetRowCellValue(e.RowHandle, colEOH) == DBNull.Value)
            {
                view.SetColumnError(colEOH, "Boş");
                e.Valid = false;
            }

            if (e.Valid && ROT.ToString() == "I" && ACCID != DBNull.Value && EOH == DBNull.Value)
            {
                view.SetColumnError(colEOH, "Boş");
                e.Valid = false;
            }
        }
예제 #11
0
    private void gvDetail_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
    {
        DataRow dr = default(DataRow);

        dr = gvDetail.GetDataRow(e.RowHandle);

        if (decimal.Parse(dr["ProductId"].ToString()) <= 0)
        {
            e.Valid = false;
            return;
        }

        else if (decimal.Parse(dr["Qty"].ToString()) <= 0)
        {
            //Quantity = "Less than one";
            e.Valid = false;
            return;
        }
        else if (string.IsNullOrEmpty(dr["FlagIO"].ToString()))
        {
            //Quantity = "Less than one";
            e.Valid = false;
            return;
        }



        else if (dr.RowState == DataRowState.Detached)
        {
            if (dset.Tables["AdjustmentDetail"].Select("ProductId =" + dr["ProductId"].ToString()).Length > 0)
            {
                MessageBox.Show("Item Already Exists", "Same Items can not be repeated.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.Valid = false;
                return;
            }
        }


        e.Valid = true;
        gvDetail.GetDataRow(e.RowHandle)["AdjustId"] = drMaster["AdjustId"];     //SalesMasterId;
    }
예제 #12
0
        private void serviceOrderBillView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView   view = sender as GridView;
            GridColumn serviceNameColumn = view.Columns["MA_DICH_VU"];
            String     serviceName       = view.GetRowCellDisplayText(e.RowHandle, serviceNameColumn);

            if (serviceName == serviceLookupEdit.NullText)
            {
                e.Valid = false;
                view.SetColumnError(serviceNameColumn, "Làm ơn chọn dịch vụ");
            }

            GridColumn serviceDateColumn = view.Columns["NGAY_PHUC_VU"];
            String     date = view.GetRowCellDisplayText(e.RowHandle, serviceDateColumn);

            if (date == serviceDateEdit.NullText)
            {
                e.Valid = false;
                view.SetColumnError(serviceDateColumn, "Làm ơn chọn ngày");
            }
        }
예제 #13
0
        private void destinationsGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int         RowHandler  = e.RowHandle;
            int         id          = Convert.ToInt32(GetString(RowHandler, "Id"));
            Destination destination = (id == 0) ? new Destination() : Database.Connection.Get <Destination>(id);

            destination.Name    = GetString(RowHandler, "Name");
            destination.address = GetString(RowHandler, "address");
            destination.Type    = GetString(RowHandler, "Type");


            if (id == 0)
            {
                Database.Connection.Insert <Destination>(destination);
                destinationsGridView.SetRowCellValue(RowHandler, "Id", destination.Id);
            }
            else
            {
                Database.Connection.Update <Destination>(destination);
            }
        }
예제 #14
0
파일: AbmXF.cs 프로젝트: SenerDemiral/M2
        private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView View = sender as GridView;
            var      aaa  = View.GetRowCellValue(e.RowHandle, colKFT);

            if (View.GetRowCellValue(e.RowHandle, colKFT) == DBNull.Value)
            {
                View.SetColumnError(colKFT, "Hesap girin");
                e.Valid = false;
            }
            else
            {
                View.ClearColumnErrors();
                e.Valid = true;
            }

            if (View.GetRowCellDisplayText(e.RowHandle, colDVT) == "TRL")
            {
                View.SetRowCellValue(e.RowHandle, colKur, 1.0);
            }
        }
예제 #15
0
        private void veichlesGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int  RowHandler = e.RowHandle;
            int  id         = Convert.ToInt32(GetString(RowHandler, "Id"));
            User user       = (id == 0) ? new User() : Database.Connection.Get <User>(id);

            user.Name     = GetString(RowHandler, "Name");
            user.Usename  = GetString(RowHandler, "Usename");
            user.Paasword = GetString(RowHandler, "Paasword");
            user.Role     = GetString(RowHandler, "Role");

            if (id == 0)
            {
                Database.Connection.Insert <User>(user);
                userGridView.SetRowCellValue(RowHandler, "Id", user.Id);
            }
            else
            {
                Database.Connection.Update <User>(user);
            }
        }
예제 #16
0
        private void grvKhoVatTuCT_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            STO_KhoVatTuCT kho = (STO_KhoVatTuCT)grvKhoVatTuCT.GetFocusedRow();

            if (kho.STO_VatTu.STO_LoaiVatTu.Ma_loai_vat_tu == "NAN")
            {
                bool   bError = false;
                string sError = "";

                var Don_gia_nhap = grvKhoVatTuCT.GetRowCellValue(e.RowHandle, colDon_gia_nhap);

                if (Don_gia_nhap != null)
                {
                    bError = true;
                    grvKhoVatTuCT.SetColumnError(colDon_gia_nhap, "Không nhập đơn giá nhập cho vật tư loại NAN");
                }

                var Don_gia_xuat = grvKhoVatTuCT.GetRowCellValue(e.RowHandle, colDon_gia_xuat);

                if (Don_gia_xuat != null)
                {
                    bError = true;
                    grvKhoVatTuCT.SetColumnError(colDon_gia_xuat, "Không nhập đơn giá xuất cho vật tư loại NAN");
                }

                if (bError)
                {
                    e.Valid = false;
                    return;
                }
            }

            if (grvKhoVatTuCT.IsNewItemRow(e.RowHandle))
            {
            }
            else
            {
                UpdateKhoVatTuCT();
            }
        }
예제 #17
0
        private void gridViewDanhMucCD_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int         id   = int.Parse(gridViewDanhMucCD.GetFocusedRowCellValue(colIDDanhMucCD).ToString());
            nvDanhMucCD dmuc = DataProvider.Ins.DB.nvDanhMucCDs.Find(id);

            if (dmuc == null)
            {
                dmuc             = new nvDanhMucCD();
                dmuc.TenChucDanh = gridViewDanhMucCD.GetRowCellValue(e.RowHandle, colTenChucDanh).ToString();
                if (DataProvider.Ins.DB.nvDanhMucCDs.Where(q => q.TenChucDanh == dmuc.TenChucDanh).Count() == 1)
                {
                    MessageBox.Show("Tên danh mục đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //gridView1.DeleteRow(e.RowHandle);
                    gridViewDanhMucCD.CancelUpdateCurrentRow();
                    return;
                }
                else
                {
                    dmuc.DaXoa   = 0;
                    dmuc.NgayTao = dmuc.NgayCapNhat = DateTime.Now;
                    DataProvider.Ins.DB.nvDanhMucCDs.Add(dmuc);
                }
            }
            else
            {
                dmuc.TenChucDanh = gridViewDanhMucCD.GetRowCellValue(e.RowHandle, colTenChucDanh).ToString();
                if (DataProvider.Ins.DB.nvDanhMucCDs.Where(q => q.TenChucDanh == dmuc.TenChucDanh).Count() == 1)
                {
                    MessageBox.Show("Tên danh mục đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    gridViewDanhMucCD.CancelUpdateCurrentRow();
                    return;
                }
                else
                {
                    dmuc.NgayCapNhat = DateTime.Now;
                }
            }
            DataProvider.Ins.DB.SaveChanges();
            this.nvDanhMucCDTableAdapter.Fill(this.anGiangDataSet.nvDanhMucCD);
        }
예제 #18
0
        private void grvThuocTinh_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            bool   bError = false;
            string sError = "";

            var ID_thuoc_tinh = grvThuocTinh.GetRowCellValue(e.RowHandle, "ID_thuoc_tinh");

            if (ID_thuoc_tinh.Equals(0))
            {
                bError  = true;
                sError += "\n Chưa chọn thuộc tính.";
            }
            else
            {
                int n = grvThuocTinh.RowCount;

                for (int i = 0; i < n; i++)
                {
                    if (i != e.RowHandle)
                    {
                        var id = grvThuocTinh.GetRowCellValue(i, "ID_thuoc_tinh");

                        if (ID_thuoc_tinh.Equals(id))
                        {
                            bError  = true;
                            sError += "\n Không được chọn trùng thuộc tính.";
                            break;
                        }
                    }
                }
            }

            if (bError)
            {
                e.ErrorText = sError + "\n Bạn có muốn sửa lại không?\n";
                e.Valid     = false;
                //XtraMessageBox.Show(sError, "Lỗi dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
예제 #19
0
        private void sec_event_gw_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int cnt = 0;

            foreach (var item in sec_event_gw.GetDataRow(e.RowHandle).ItemArray)
            {
                if (item.ToString() == "")
                {
                    cnt += 1;
                }
            }
            if (cnt >= sec_event_gw.GetDataRow(e.RowHandle).ItemArray.Count() - 1)
            {
                e.ErrorText = "Пустая строка не может быть сохранена.";
                e.Valid     = false;
            }
            if (sec_event_gw.GetRowCellValue(e.RowHandle, colTYPE_NAME).ToString() == "")
            {
                e.ErrorText = "Заполните наименование типа вторичного события.";
                e.Valid     = false;
            }
        }
예제 #20
0
 private void gridViewNhomQuyen_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     //NhomQuyen objNhomQuyen = e.Row as NhomQuyen;
     //if (objNhomQuyen != null)
     //{
     //    objNhomQuyen.AddValidationRuleHandler(RuleCheckDuplicate, "TenNhomQuyen");
     //    if (objNhomQuyen.IsValid)
     //        e.Valid = true;
     //    else
     //    {
     //        XtraMessageBox.Show(objNhomQuyen.Error, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     //        e.Valid = false;
     //    }
     //}
     //if (e.Valid == true)
     //    btnLuu.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
     //else
     //{
     //    btnLuu.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     //    return;
     //}
 }
예제 #21
0
        private void veichlesGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int     RowHandler = e.RowHandle;
            int     id         = Convert.ToInt32(GetString(RowHandler, "Id"));
            Veichle veichle    = (id == 0) ? new Veichle() : Database.Connection.Get <Veichle>(id);

            veichle.Brand      = GetString(RowHandler, "Brand");
            veichle.ChaceeId   = GetString(RowHandler, "ChaceeId");
            veichle.PlateId    = GetString(RowHandler, "PlateId");
            veichle.Type       = GetString(RowHandler, "Type");
            veichle.GPS_Serial = GetString(RowHandler, "GPS_Serial");

            if (id == 0)
            {
                Database.Connection.Insert <Veichle>(veichle);
                veichlesGridView.SetRowCellValue(RowHandler, "Id", veichle.Id);
            }
            else
            {
                Database.Connection.Update <Veichle>(veichle);
            }
        }
        private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView   view      = sender as GridView;
            GridColumn Qty       = view.Columns["Qty"];
            GridColumn QtyActual = view.Columns["QtyActual"];
            //Get the value of the first column
            decimal intQty = (decimal)view.GetRowCellValue(e.RowHandle, Qty);
            //Get the value of the second column
            decimal intQtyActual = (decimal)view.GetRowCellValue(e.RowHandle, QtyActual);

            // [Qty] - [QtyActual]
            decimal result = (intQty - intQtyActual);

            //Validity criterion
            if (result < 0)
            {
                e.Valid = false;
                //Set errors with specific descriptions for the columns
                //view.SetColumnError(Qty, "The value must be greater than Units On Order");
                view.SetColumnError(QtyActual, "จำนวนเบิก ห้ามเกินจำนวนสินค้า...กรุณาแก้ไขด้วยครับ");
            }
        }
예제 #23
0
        private void variable_gw_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int cnt = 0;

            foreach (var item in variable_gw.GetDataRow(e.RowHandle).ItemArray)
            {
                if (item.ToString() == "")
                {
                    cnt += 1;
                }
            }
            if (cnt >= variable_gw.GetDataRow(e.RowHandle).ItemArray.Count() - 1)
            {
                e.ErrorText = "Пустая строка не может быть сохранена.";
                e.Valid     = false;
            }
            if (variable_gw.GetRowCellValue(e.RowHandle, colVARIABLE_NAME).ToString() == "")
            {
                e.ErrorText = "Заполните наименование переменной.";
                e.Valid     = false;
            }
        }
예제 #24
0
 private void ComprobarNombreColumna(DatosEntidad linea, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     if (linea == null)
     {
         return;
     }
     if (String.IsNullOrEmpty(linea.Columna))
     {
         e.Valid     = false;
         e.ErrorText = "No ha rellenado el nombre de la columna";
     }
     else if (linea.Columna.Any(Char.IsWhiteSpace))
     {
         e.Valid     = false;
         e.ErrorText = "El nombre de la propiedad no puede tener espacios";
     }
     else if (_listaDatos.FindAll(d => d.Columna.ToUpper() == linea.Columna.ToUpper()).Count > 1)
     {
         e.Valid     = false;
         e.ErrorText = "El nombre de la columna está repetido";
     }
 }
예제 #25
0
        private void grvMenu_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            var item = e.Row as Logic.Entities.Menu;

            e.Valid = false;
            if (string.IsNullOrEmpty(item.MenuType))
            {
                e.ErrorText = "Please enter menu type";
            }
            else if (item.RestaurantId <= 0)
            {
                e.ErrorText = "Please select restaurant";
            }
            else if (item.StartDate > item.EndDate)
            {
                e.ErrorText = "End date must be greater than start date";
            }
            else
            {
                e.Valid = true;
            }
        }
예제 #26
0
        private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            ////Validate new row only
            //if (e.RowHandle != GridControl.NewItemRowHandle)
            //{
            //    return;
            //}
            DataAccess.ItemCategory currentRow = (DataAccess.ItemCategory)gridView1.GetFocusedRow();

            if (currentRow.Category == null || currentRow.Category == string.Empty)
            {
                e.Valid = false;
                gridView1.SetColumnError(colCategory, "Category must have a value");
            }
            else
            if (currentRow.Category != null && currentRow.Category.Length > 50)
            {
                e.Valid = false;
                gridView1.SetColumnError(colCategory, "50 characters maximum");
            }

            if (currentRow.code == null || currentRow.code == string.Empty)
            {
                e.Valid = false;
                gridView1.SetColumnError(colcode, "Code must have a value");
            }
            else
            if (currentRow.Category != null && currentRow.code.Length != 2)
            {
                e.Valid = false;
                gridView1.SetColumnError(colcode, "The value must be 2 characters");
            }

            if (currentRow.Description != null && currentRow.Description.Length > 50)
            {
                e.Valid = false;
                gridView1.SetColumnError(colDescription, "50 characters maximum");
            }
        }
        private void template_gw_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int cnt = 0;

            foreach (var item in template_gw.GetDataRow(e.RowHandle).ItemArray)
            {
                if (item.ToString() == "")
                {
                    cnt += 1;
                }
            }
            if (cnt >= template_gw.GetDataRow(e.RowHandle).ItemArray.Count() - 2)
            {
                e.ErrorText = "Пустая строка не может быть сохранена.";
                e.Valid     = false;
            }
            if (template_gw.GetRowCellValue(e.RowHandle, colTEMPLATE_NAME).ToString() == "")
            {
                e.ErrorText = "Заполните наименование шаблона.";
                e.Valid     = false;
            }
            if (template_gw.GetRowCellValue(e.RowHandle, colTYPE_SEC_EVENT).ToString() == "")
            {
                e.ErrorText = "Заполните тип вторичного события.";
                e.Valid     = false;
            }
            //try
            //{
            //    if (cUS_TEMPLATE_SEC_EVENT_TBTableAdapter.tempIsExist(template_gw.GetRowCellValue(e.RowHandle, colTEMPLATE_NAME).ToString(), Convert.ToDecimal(template_gw.GetRowCellValue(e.RowHandle, colTYPE_SEC_EVENT).ToString())) != 0)
            //    {
            //        e.ErrorText = "шаблон с таким наименованием и типом вторичного события уже существует.";
            //        e.Valid = false;
            //        //template_gw.SetRowCellValue(e.RowHandle, colTYPE_SEC_EVENT, null);
            //    }
            //}
            //catch (Exception)
            //{
            //}
        }
예제 #28
0
        private void lineNamesGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int          RowHandler   = e.RowHandle;
            int          id           = Convert.ToInt32(GetString(RowHandler, "Id"));
            ShippingLine shippingline = (id == 0) ? new ShippingLine() : Database.Connection.Get <ShippingLine>(id);

            shippingline.Name    = GetString(RowHandler, "Name");
            shippingline.Address = GetString(RowHandler, "Address");
            shippingline.Phone   = GetString(RowHandler, "Phone");
            shippingline.Mail    = GetString(RowHandler, "Mail");


            if (id == 0)
            {
                Database.Connection.Insert <ShippingLine>(shippingline);
                lineNamesGridView.SetRowCellValue(RowHandler, "Id", shippingline.Id);
            }
            else
            {
                Database.Connection.Update <ShippingLine>(shippingline);
            }
        }
예제 #29
0
        void gridView_efectivo_monedas_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            int nerror = 0;

            this.gridView_efectivo_monedas.GetDataRow(e.RowHandle).ClearErrors();
            // VALIDA LA COLUMNA DE CANTIDAD //
            if ((decimal)this.textBox_monto_total_desgloce.textEdit1.EditValue > ln_total_efectivo_depositos_det)
            {
                this.gridView_efectivo_monedas.GetDataRow(e.RowHandle).SetColumnError(3, "Monto del desgloce NO puede mayor al monto total del efectivo...");
                nerror = nerror + 1;
            }

            if (nerror > 0)
            {
                e.Valid = false;
            }
            else
            {
                this.gridView_efectivo_monedas.GetDataRow(e.RowHandle).ClearErrors();
                e.Valid = true;
            }
        }
예제 #30
0
        private void gvAccount_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.IsNewItemRow(e.RowHandle))
            {
                InsertAccount(view, e.RowHandle);
            }
            else
            {
                string curUserName = view.GetRowCellValue(e.RowHandle, view.Columns[0]).ToString();
                for (int i = 0; i < view.RowCount - 1; i++)
                {
                    if (curUserName.Equals(view.GetRowCellValue(i, view.Columns[0]).ToString()))
                    {
                        view.SetRowCellValue(view.FocusedRowHandle, view.Columns[0], "");

                        return;
                    }
                }
            }
        }