Пример #1
0
        private void Uc_Vehicle1_SelectByIdRequest(object sender, ProcEventArgs e)
        {
            var procName = Utility.GetStProcName(e.ProcKey);

            var db    = new DbOperations(connectionString);
            var table = db.SelectSingleById(procName, e.SelectRequestId);

            uc_Vehicle1.SelectByIdProcResult(table);
        }
Пример #2
0
        private void Uc_Vehicle1_InsertRequest(object sender, ProcEventArgs e)
        {
            var procName = Utility.GetStProcName(e.ProcKey);

            var db = new DbOperations(connectionString);
            Dictionary <string, object> insertDict = new Dictionary <string, object>();

            insertDict.Add(keyColumnMake, uc_Vehicle1.Make);
            insertDict.Add(keyColumnModel, uc_Vehicle1.Model);
            insertDict.Add(keyColumnYear, uc_Vehicle1.Year);
            insertDict.Add(keyColumnLicensePlate, uc_Vehicle1.LicensePlate);
            insertDict.Add(keyColumnColor, uc_Vehicle1.Color);

            int newRecordId = db.InsertSingle(procName, insertDict);

            uc_Vehicle1.InsertProcResult(newRecordId);
        }
Пример #3
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            //ResetForm();

            var vehicle = new Vehicle();

            Make         = txtMake.Text.Trim();
            Model        = txtModel.Text.Trim();
            LicensePlate = txtLicensePlate.Text.Trim();
            Color        = txtColor.Text.Trim();

            if (ValidateInsertModel())
            {
                ProcEventArgs args = new ProcEventArgs();
                args.ProcKey = insertProcKey;
                InsertRequest(this, args);
            }
        }
Пример #4
0
        //private void ResetDataSelection()
        //{
        //    dataId.Text = "";
        //    dataMake.Text = "";
        //    dataModel.Text = "";
        //    dataYear.Text = "";
        //    dataLicensePlate.Text = "";
        //    dataColor.Text = "";
        //}

        private void btnSelect_Click(object sender, EventArgs e)
        {
            int id = 0;

            if (Int32.TryParse(txtId.Text, out id))
            {
                if (id > 0)
                {
                    ResetErrorMessages();
                    ResetInputsOutputs();
                    ProcEventArgs args = new ProcEventArgs();
                    args.ProcKey = selectByIdProcKey;

                    args.SelectRequestId = id;
                    SelectByIdRequest(this, args);
                    txtId.Text = id.ToString();
                    return;
                }
            }

            lblRecordError.Text = "Invalid Format";
            lblRecordError.Show();
        }