示例#1
0
        public ConditionEC(String tableName, String nameCondition, String EventsSupport)
        {
            InitializeComponent();
            TableName = tableName;
            if (TablesNamesListBinding == null)
            {
                TablesNamesListBinding = new BindingList <string>
                {
                    tableName
                };
            }

            if (RowsCharge == null)
            {
                RowsCharge = new List <ItemconditionModel>();
            }



            QueryStructure = "{SelecCondition} ";

            TxtQueryResult.Multiline     = true;
            TxtQueryResult.ScrollBars    = ScrollBars.Vertical;
            TxtQueryResult.AcceptsTab    = true;
            TxtQueryResult.AcceptsReturn = true;
            TxtQueryResult.WordWrap      = true;
            TxtQueryResult.Height        = 200;


            TxtQueryResult.Text = QueryStructure.Replace("{SelecCondition}", "SELECT  * FROM " + TablesNamesListBinding[0] + " WHERE ");

            LblTableNAme.Text         = tableName;
            LblNotificationName.Text  = nameCondition;
            LblEventNotification.Text = EventsSupport;
        }
示例#2
0
        public void ChangeValueItem(String Identifier, String value, String conector)
        {
            Boolean hastLasRowtValue      = true;
            int     postition             = 0;
            Boolean hastValueCurrentQuery = false;

            hastValueCurrentQuery = RowsCharge.FirstOrDefault(r => r.Identifier == Identifier) != null;

            if (hastValueCurrentQuery)
            {
                RowsCharge.FirstOrDefault(r => r.Identifier == Identifier).Conector = conector;
                postition = RowsCharge.IndexOf(RowsCharge.FirstOrDefault(r => r.Identifier == Identifier));
            }

            if (postition > 0)
            {
                hastLasRowtValue = RowsCharge[postition - 1].ValueQuery != null;
            }


            if (RowsCharge.FirstOrDefault(v => v.LastValueQuery.Contains(value)) == null && hastLasRowtValue && hastValueCurrentQuery)
            {
                if (postition == 0)
                {
                    RowsCharge[postition].ValueQuery = value;
                    QueryStructure = QueryStructure.Replace(RowsCharge[postition].LastValueQuery, value);
                    RowsCharge[postition].LastValueQuery = value;
                }
                else
                {
                    RowsCharge[postition].ValueQuery = " " + RowsCharge[postition - 1].Conector + " " + value;
                    QueryStructure = QueryStructure.Replace(RowsCharge[postition].LastValueQuery, " " + RowsCharge[postition - 1].Conector + " " + value);
                    RowsCharge[postition].LastValueQuery = " " + RowsCharge[postition - 1].Conector + " " + value;
                }
            }
            else if (RowsCharge[postition].LastValueQuery != null && TableDelete != null)
            {
                Boolean hasContains = false;
                foreach (String item  in TableDelete)
                {
                    hasContains = RowsCharge[postition].LastValueQuery.Contains(item) || RowsCharge[postition].LastValueQuery.Contains(" {" + RowsCharge[postition].Identifier + "}");
                }
                if (hasContains)
                {
                    QueryStructure = QueryStructure.Replace(RowsCharge[postition].LastValueQuery, " {" + RowsCharge[postition].Identifier + "}");
                }
            }

            if (RowsCharge.Count - 1 > postition && RowsCharge[postition + 1].ValueQuery != null)
            {
                RowsCharge[postition + 1].ValueQuery = " " + RowsCharge[postition].Conector + RowsCharge[postition + 1].ValueQuery.Replace("OR ", "").Replace("AND ", "");
                QueryStructure = QueryStructure.Replace(RowsCharge[postition + 1].LastValueQuery, RowsCharge[postition + 1].ValueQuery);
                RowsCharge[postition + 1].LastValueQuery = RowsCharge[postition + 1].ValueQuery;
            }

            SetTextInterface();
        }
示例#3
0
        private void BtnDeleteCondition_Click(object sender, EventArgs e)
        {
            int postition = 0;
            List <ItemconditionModel> listDelete = RowsCharge.Where(r => r.IsCheked).ToList();

            if (listDelete != null)
            {
                foreach (ItemconditionModel item in listDelete)
                {
                    RowsCharge.Remove(item);
                    QueryStructure = QueryStructure.Replace(item.LastValueQuery, "");
                    postition      = PnlConditions.Controls.IndexOf(item.Intance);
                    PnlConditions.Controls.Remove(item.Intance);
                    if (postition == 0 && item.ValueQuery != null)
                    {
                        QueryStructure = QueryStructure.Replace(item.LastValueQuery, item.ValueQuery?.Replace(item.Conector, ""));
                    }
                    ReajustAling();
                    SetTextInterface();
                }
                listDelete.Clear();
            }
        }