예제 #1
0
        string GetValidationError(string propertyName)
        {
            BusinessRules br = new BusinessRules();
            string error = null;
            switch (propertyName)
            {
                case "Text":
                    Foreground = "Black";
                    BorderThickness = "1";
                    BorderBrush = "Black";
                    if (this.Mandatory)
                    {
                        if (this.Text != null && br.IsStringMissing(this.Text))
                        {
                            BorderBrush = "Red";
                            ToolTip = "Cannot be blank";
                            BorderThickness = "3";
                        }
                        else
                        {
                            BorderBrush = "Black";
                            ToolTip = this.Label;
                        }
                    }
                    else
                    {
                        ToolTip = this.Label;
                        BorderBrush = "Black";
                    }

                    if (this.DataType.Equals("INT"))
                    {
                        if (!br.ValidateInt(this.Text))
                        {
                            Foreground = "Red";
                            BorderBrush = "Red";
                            BorderThickness = "3";
                            ToolTip = "Invalid data, accepts integers only";
                        }
                        else
                        {
                            Foreground = "Black";
                            ToolTip = this.Label;
                        }
                    }
                    break;
                case "Background":
                    if (this.Mandatory)
                    {
                        Background = "Cyan";
                    }
                    else
                    {
                        Background = "White";
                    }
                    break;
            }

            return error;
        }
예제 #2
0
 public void CommandController(object sender)
 {
     DataTable dt;
     string strMsg;
     BusinessRules objUIRules = new BusinessRules();
     Util objCommonUtil = new Util();
     switch ((string)sender)
     {
         case "AccountCreate":
             //UI Validation
             strMsg = objUIRules.ValidateUIInfo(PACTControlData);
             if (strMsg != null && !strMsg.Equals(""))
             {
                 objCommonUtil.InfoMessageBox(strMsg, "Validations");
                 break;
             }
             //Building collection to post values to DB
             dt = objCommonUtil.GetDBValues(PACTControlData);
             if (dt != null)
             {
                 System.IO.StringWriter writer = new System.IO.StringWriter();
                 dt.WriteXml(writer);
                 int retVal = objControlGenerator.PostData(writer.ToString(), _ScreenID, ShellWindowViewModel.CompanyIndex);
                 if (retVal > 0)
                     objCommonUtil.InfoMessageBox("Record added sucessfully.", "Validations");
             }
             break;
         case "SaveDepreciation":
             //UI Validation
             strMsg = objUIRules.ValidateUIInfo(PACTControlData);
             if (strMsg != null && !strMsg.Equals(""))
             {
                 objCommonUtil.InfoMessageBox(strMsg, "Validations");
                 break;
             }
             //Building collection to post values to DB
             dt = objCommonUtil.GetDBValues(PACTControlData);
             if (dt != null)
             {
                 System.IO.StringWriter writer = new System.IO.StringWriter();
                 dt.WriteXml(writer);
                 int retVal = objControlGenerator.PostData(writer.ToString(), _ScreenID, ShellWindowViewModel.CompanyIndex);
                 if (retVal > 0)
                     objCommonUtil.InfoMessageBox("Record added sucessfully.", "Validations");
             }
             break;
     }
 }
예제 #3
0
        string GetValidationError(string propertyName)
        {
            BusinessRules br    = new BusinessRules();
            string        error = null;

            switch (propertyName)
            {
            case "Text":
                Foreground      = "Black";
                BorderThickness = "1";
                BorderBrush     = "Black";
                if (this.Mandatory)
                {
                    if (this.Text != null && br.IsStringMissing(this.Text))
                    {
                        BorderBrush     = "Red";
                        ToolTip         = "Cannot be blank";
                        BorderThickness = "2";
                    }
                    else
                    {
                        BorderBrush = "Black";
                        ToolTip     = this.Label;
                    }
                }
                else
                {
                    ToolTip     = this.Label;
                    BorderBrush = "Black";
                }

                if (this.DataType.Equals("INT"))
                {
                    if (!br.ValidateInt(this.Text))
                    {
                        Foreground      = "Red";
                        BorderBrush     = "Red";
                        BorderThickness = "2";
                        ToolTip         = "Invalid data, accepts integers only";
                    }
                    else
                    {
                        Foreground = "Black";
                        ToolTip    = this.Label;
                    }
                }
                else if (this.DataType.Equals("FLOAT"))
                {
                    if (!br.ValidateDecimal(this.Text))
                    {
                        Foreground      = "Red";
                        BorderBrush     = "Red";
                        BorderThickness = "2";
                        ToolTip         = "Invalid data, accepts numerics only";
                    }
                    else
                    {
                        Foreground = "Black";
                        ToolTip    = this.Label;
                    }
                }
                break;

            case "Background":
                if (this.Mandatory)
                {
                    Background = "Cyan";
                }
                else
                {
                    Background = "White";
                }
                break;
            }

            return(error);
        }
예제 #4
0
        string GetValidationError(string propertyName)
        {
            BusinessRules br = new BusinessRules();
            string error = null;
            switch (propertyName)
            {
                case "SelectedValue":
                    Foreground = "Black";
                    BorderThickness = "1";
                    BorderBrush = "Black";
                    if (this.Mandatory)
                    {
                        if (br.IsStringMissing(this.SelectedValue))
                        {
                            BorderBrush = "Red";
                            ToolTip = "Cannot be blank";
                            BorderThickness = "2";
                        }
                        else
                        {
                            BorderBrush = "Black";
                            ToolTip = this.Label;
                        }
                    }
                    else
                    {
                        ToolTip = this.Label;
                        BorderBrush = "Black";
                    }
                    break;
                case "Background":
                    if (this.Mandatory)
                    {
                        Background = "Cyan";
                    }
                    else
                    {
                        Background = "White";
                    }
                    break;
            }

            return error;
        }