Example #1
0
        private void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
        {
            var columnName = e.Cell.Column.UniqueName;

            DateTime dateTime;

            if (columnName.TryParse(out dateTime))
            {
                // This is a date time column and vertex evidence cell
                var vertexEvidence = this.SelectedVertex.States.ParseEvidenceString(e.NewValue as string);

                if (vertexEvidence.Type == VertexEvidenceType.Invalid)
                {
                    e.IsValid      = false;
                    e.ErrorMessage = "Invalid evidence for node " + this.SelectedVertex.Key;
                }
            }
            else if (columnName.Equals("Comment"))
            {
            }

            else if (!(this.PipeLineData.BaseTableMin <= (double)e.NewValue && (double)e.NewValue <= this.PipeLineData.BaseTableMax))
            {
                e.IsValid      = false;
                e.ErrorMessage = "sections should be within pipeline length";
            }
        }
 void gvwRole_CellValidating(object sender, GridViewCellValidatingEventArgs e)
 {
     if (e.Cell.Column.UniqueName == "RoleName")
     {
         if (e.NewValue == null || string.IsNullOrEmpty(e.NewValue.ToString()))
         {
             e.IsValid = false;
             e.ErrorMessage = ResourceHelper.GetReourceValue("Common_RequiredFieldGeneric");
         }
     }
 }
        void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
        {
            bool isValid = true;
            string validationText = "Validation failed. ";
            GridViewCell cell = e.Cell;
            switch (cell.Column.UniqueName)
            {
                case "ContactName":
                    isValid = ValidateName((string)e.NewValue);
                    if (!isValid)
                    {
                        validationText += "The name of the customer may contain only Latin letters" +
                                          Environment.NewLine + "and empty spaces and must start with a letter.";
                    }
                    break;
                case "Country":
                    isValid = this.ValidateCountry((string)e.NewValue);
                    if (!isValid)
                    {
                        validationText += "The name of the country must match the name of an existing one.";
                    }
                    break;
                case "Phone":
                    isValid = ValidatePhone((string)e.NewValue);
                    if (!isValid)
                    {
                        validationText += "The phone must be in one of the formats X.X.X.X, Y or (X) Y, where " +
                                          Environment.NewLine +
                                          "X is a random sequence of numerals and Y is a random sequence of numerals, " +
                                          Environment.NewLine +
                                          "empty spaces and '-', which starts and ends with a numeral.";
                    }
                    break;
                case "PostalCode":
                    isValid = ValidatePostalCode(e.NewValue);
                    if (!isValid)
                    {
                        validationText += "The postal code of the customer must not be empty.";
                    }
                    break;
            }
            if (!isValid)
            {
                this.MarkCell(cell, validationText);
            }
            else
            {
                this.RestoreCell(cell);
            }

            e.ErrorMessage = validationText;
            e.IsValid = isValid;
        }
        private void SLStandardradGridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
        {
            var error = ((TextBox)e.EditingElement).Text;

            if (error == null || error == "")
            {
                e.ErrorMessage = "شرح استاندارد نباید خالی باشد";
                e.IsValid      = false;
            }
            //e.ErrorMessage = "ggfgff";
            //e.IsValid = false;

            //  var ee = ((RadComboBox)e.EditingElement).SelectedValue==null;
        }
Example #5
0
 void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
 {
     if (e.Cell.Column.UniqueName != null && e.Cell.Column.UniqueName.Equals("ObjClasschild.STen"))
     {
         e.IsValid = true;
         if (e.NewValue.Equals("11"))
         {
             e.IsValid      = false;
             e.ErrorMessage = "Lỗi to như quả bóng";
         }
         if (e.NewValue.Equals("22"))
         {
             e.IsValid      = false;
             e.ErrorMessage = "Lỗi to như quả khí cầu";
         }
     }
 }
        private void radGridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
        {
            if (e.Cell.Column.Name == "ProductName")
            {
                var ee = ((RadComboBox)e.EditingElement).SelectedValue;
                if (ee == null)
                {
                    e.ErrorMessage = "نام محصول را انتخاب نمایید";
                    e.IsValid      = false;
                }
            }
            //else if (((GridViewCellValidatingEventArgs)e).Cell.Column.Name == "Ratio")
            //{
            //    var ee = (e.EditingElement).SelectedValue;
            //    if (ee == null)
            //    {
            //        e.ErrorMessage = "نام محصول را انتخاب نمایید";
            //        e.IsValid = false;
            //    }

            //}
            //Order
        }
Example #7
0
 void gvwBooking_CellValidating(object sender, GridViewCellValidatingEventArgs e)
 {
     //if (e.Cell.Column.UniqueName == "BookingType"
     //    || e.Cell.Column.UniqueName == "BookingStatus"
     //    || e.Cell.Column.UniqueName == "BookingName")
     //{
     //    if (e.NewValue == null || string.IsNullOrEmpty(e.NewValue.ToString()))
     //    {
     //        e.IsValid = false;
     //        e.ErrorMessage = Globals.UserMessages.RequiredFieldGeneric;
     //    }
     //}
 }
 private void radGridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
 {
 }
        void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e)
        {
            bool isValid = true;
            //string hinhThucTT = "";
            //string validationText = "Validation failed. ";
            string       validationText = "Giá trị không phù hợp. ";
            GridViewCell cell           = e.Cell;
            Grid         grid           = null;

            switch (cell.Column.UniqueName)
            {
            case "ContactName":
                isValid = ValidateName((string)e.NewValue);
                if (!isValid)
                {
                    validationText += "The name of the customer may contain only Latin letters" +
                                      Environment.NewLine + "and empty spaces and must start with a letter.";
                }
                break;

            case "Country":
                isValid = this.ValidateCountry((string)e.NewValue);
                if (!isValid)
                {
                    validationText += "The name of the country must match the name of an existing one.";
                }
                break;

            case "Phone":
                isValid = ValidatePhone((string)e.NewValue);
                if (!isValid)
                {
                    validationText += "The phone must be in one of the formats X.X.X.X, Y or (X) Y, where " +
                                      Environment.NewLine +
                                      "X is a random sequence of numerals and Y is a random sequence of numerals, " +
                                      Environment.NewLine +
                                      "empty spaces and '-', which starts and ends with a numeral.";
                }
                break;

            case "PostalCode":
                isValid = ValidatePostalCode(e.NewValue);
                if (!isValid)
                {
                    validationText += "The postal code of the customer must not be empty.";
                }
                break;

            // Truongnx add
            case "SO_CTU":

                isValid = ValidateSO_CTU((string)e.NewValue);
                if (!isValid)
                {
                    validationText += "Số chứng từ không được để trống.";
                }
                break;

                //case "NGAY_CTU":
                //isValid = ValidateNGAY_CTU((string)e.NewValue);
                //if (!isValid)
                //{
                //    validationText += "Ngày chứng từ không được để trống.";
                //}
                //break;

                //grid = e.EditingElement as Grid;
                //RadDatePicker rdp = grid.FindChildByType<RadDatePicker>();
                //if (rdp != null && rdp.SelectedDate != null)
                //{
                //    isValid = ValidateNGAY_CTU(rdp.SelectedDate.GetValueOrDefault().ToString("dd/MM/yyyy"));
                //    if (!isValid)
                //    {
                //        validationText += "Ngày chứng từ không được để trống.";
                //    }
                //}
                //else if (rdp.SelectedDate == null)
                //{
                //    isValid = false;
                //    if (!isValid)
                //    {
                //        validationText += "Ngày chứng từ không được để trống.";
                //    }
                //}
                //break;


                //case "GIA_TRI":

                //    isValid = ValidateGIA_TRI(((decimal)e.NewValue).ToString());
                //    if (!isValid)
                //    {
                //        validationText += "Giá trị nguyên giá không được để trống và chỉ là các ký tự số.";
                //    }
                //    break;
                //case "TKHOAN_TTOAN":
                //    grid = e.EditingElement as Grid;
                //    TextBox txt = grid.FindChildByType<TextBox>();
                //    if (txt != null)
                //    {
                //        isValid = ValidateTKHOAN_TTOAN((string)txt.Text);
                //        if (!isValid)
                //        {
                //            validationText += "Tài khoản thanh toán không được để trống và chỉ là các ký tự số.";
                //        }
                //    }
                //    break;
            }
            if (!isValid)
            {
                this.MarkCell(cell, validationText);
            }
            else
            {
                this.RestoreCell(cell);
            }

            e.ErrorMessage = validationText;
            e.IsValid      = isValid;
        }