T
T
thegamestarted2021-02-18 10:49:43
.NET
thegamestarted, 2021-02-18 10:49:43

How to display the value in the textbox from the property where the data is stored?

Hello!
When entering the database, I have a form with which I set the selection parameters (specify the data).
I have two textboxes: Date From and To. After entering the database, I can change the selection parameters by calling this form again, how can I make sure that when the form is opened again in the date textboxes (from and to) there are data that was entered last time ??? Dates are written in the DATE_D_ and END_ properties i.e. in the interface itself, the dates that I entered last time are remembered using the Cursor.Properties.Set command, how can I display them now?
I tried to insert something like this into the condition: if Cursor.Properties.Contains("DATE_D") - checks if there is a record in the property, then Cursor.Properties.Get - take this property, it doesn't work like this ...
those. in fact, if there is an entry in the properties - insert these dates into the textbox, otherwise - insert the first and last day of the current month.
0NkFx.png

public class PwregCursor : DataEditorBusinessLogic.CursorLogic
{
    public override SqlCmdText GetSqlFilter()
    {
        var Cond = ITnet2.Server.Dialogs.InputForm.Activate("_TESTFRM");
        if (Cond.Success)
        {
            string Conditions = "";
            // условие по дате C 
            var date_begin = Cond.InputFormValues.GetValue<DateTime>("DATE_D");
            Cursor.Properties.Set("DATE_D_", date_begin);  // запись значений данных в свойство
            if (date_begin != null)
            {
                Conditions += " cast(PWREG.DATE_D as date) >= cast(@date_begin as date) ";
            }
            // условие по дате ПО
            var date_end = Cond.InputFormValues.GetValue<DateTime>("END");
            Cursor.Properties.Set("END_", date_end);    // запись значений данных в свойство
            if (date_end != null)
            {
                Conditions += "and cast(PWREG.DATE_D as date) <= cast(@date_end as date)";
            }
            var n_kdk = Cond.InputFormValues.GetValue<string>("N_KDK");
            var rcentr = Cond.InputFormValues.GetValue<string>("RCENTR");
            var ceh = Cond.InputFormValues.GetValue<string>("CEH");
            // условие по сотруднику
            if (n_kdk != null && n_kdk.Length > 0)
            {
                Conditions += " and PWREG.N_KDK = @n_kdk ";
            }
            // условие по рабочему центру
            if (rcentr != null && rcentr.Length > 0)
            {
                Conditions += " and PWREG.RCENTR = @rcentr ";
            }
            // условие по цеху
            if (ceh != null && ceh.Length > 0)
            {
                Conditions += " and PRCR.CEH = @ceh ";
            }
            return new SqlCmdText(string.Format(Conditions),
                new SqlParam("n_kdk", n_kdk.ToString()),
                new SqlParam("rcentr", rcentr.ToString()),
                new SqlParam("ceh", ceh.ToString()),
                new SqlParam("date_begin", date_begin),
                new SqlParam("date_end", date_end));
        }
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question