示例#1
0
 public PeopleDTO(TUObjectsDTO people)
     : base(people)
 {
     LabelsText.Add("FirstName");
     LabelsText.Add("MiddleName");
     LabelsText.Add("Address");
     LabelsText.Add("Phone");
 }
示例#2
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            AspirantsDTO aspirant = (AspirantsDTO)tuObject;
            base.Insert(aspirant);

            dbCommand.CommandText = string.Format("Insert Into Aspirants(Teacher, DesertationTopic, Scolarship) Values({0}, '{1}', {2})",
               aspirant.Teacher, aspirant.DesertationTopic, aspirant.Scolarship.ToString(NumberFormatInfo.InvariantInfo));

            dbCommand.ExecuteNonQuery();
        }
示例#3
0
        public override void Update(TUObjectsDTO tuObject)
        {
            WorkersDTO worker = (WorkersDTO)tuObject;
            base.Update(worker);

            dbCommand.CommandText = string.Format("Update Workers Set Post='{0}', Salary={1} Where Id= {2}",
                worker.Post, worker.Salary.ToString(NumberFormatInfo.InvariantInfo), worker.Id);

            dbCommand.ExecuteNonQuery();
        }
        public override void Update(TUObjectsDTO tuObject)
        {
            UniversityLearnersDTO universityLearner = (UniversityLearnersDTO)tuObject;
            base.Update(universityLearner);

            dbCommand.CommandText = string.Format("Update UniversityLearners Set EnteredYear={0} Where Id= {1}",
                universityLearner.EnteredYear, universityLearner.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#5
0
        public override void Update(TUObjectsDTO tuObject)
        {
            AspirantsDTO aspirant = (AspirantsDTO)tuObject;
            base.Update(aspirant);

            dbCommand.CommandText = string.Format("Update Aspirants Set Teacher={0}, DesertationTopic='{1}', Scolarship={2} Where Id= {3}",
                aspirant.Teacher, aspirant.DesertationTopic, aspirant.Scolarship.ToString(NumberFormatInfo.InvariantInfo), aspirant.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#6
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            PaidStudentsDTO paidStudent = (PaidStudentsDTO)tuObject;
            base.Insert(paidStudent);

            dbCommand.CommandText = string.Format("Insert Into PaidStudents(Price) Values({0})",
               paidStudent.Price.ToString(NumberFormatInfo.InvariantInfo));

            dbCommand.ExecuteNonQuery();
        }
示例#7
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            PeopleDTO people = (PeopleDTO)tuObject;
            base.Insert(tuObject);

            dbCommand.CommandText = string.Format("Insert Into People(FirstName, MiddleName, Address, Phone) Values('{0}', '{1}', '{2}', '{3}')",
                people.FirstName, people.MiddleName, people.Address, people.Phone);

            dbCommand.ExecuteNonQuery();
        }
示例#8
0
        public override void Update(TUObjectsDTO tuObject)
        {
            TeachersDTO teacher = (TeachersDTO)tuObject;
            base.Update(teacher);

            dbCommand.CommandText = string.Format("Update Teachers Set SientistLevel='{0}', AmountOfHours={1} Where Id= {2}",
               teacher.SientistLevel, teacher.AmountOfHours, teacher.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#9
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            WorkersDTO worker = (WorkersDTO)tuObject;
            base.Insert(worker);

            dbCommand.CommandText = string.Format("Insert Into Workers(Post, Salary) Values('{0}', {1})",
                worker.Post, worker.Salary.ToString(NumberFormatInfo.InvariantInfo));

            dbCommand.ExecuteNonQuery();
        }
示例#10
0
        public override void Update(TUObjectsDTO tuObject)
        {
            LearnersDTO learner = (LearnersDTO)tuObject;
            base.Update(learner);

            dbCommand.CommandText = string.Format("Update Learners Set LearnNumber='{0}' Where Id= {1}",
                learner.LearnNumber, learner.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#11
0
        public override void Update(TUObjectsDTO tuObject)
        {
            PeopleDTO people = (PeopleDTO) tuObject;
            base.Update(people);

            dbCommand.CommandText = string.Format("Update People Set FirstName='{0}', MiddleName='{1}', Address='{2}', Phone='{3}' Where Id= {4}",
                people.FirstName, people.MiddleName, people.Address, people.Phone, people.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#12
0
        public override void Update(TUObjectsDTO tuObject)
        {
            AuxiliaryWorkersDTO auxiliaryWorker = (AuxiliaryWorkersDTO)tuObject;
            base.Update(auxiliaryWorker);

            dbCommand.CommandText = string.Format("Update AuxiliaryWorkers Set Shift={0}, TypeOfWork='{1}' Where Id= {2}",
               auxiliaryWorker.Shift, auxiliaryWorker.TypeOfWork, auxiliaryWorker.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#13
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            LearnersDTO learner = (LearnersDTO)tuObject;
            base.Insert(learner);

            dbCommand.CommandText = string.Format("Insert Into Learners(LearnNumber) Values('{0}')",
                learner.LearnNumber);

            dbCommand.ExecuteNonQuery();
        }
示例#14
0
        public override void Update(TUObjectsDTO tuObject)
        {
            BudgetStudentsDTO budgetStudent = (BudgetStudentsDTO)tuObject;
            base.Update(budgetStudent);

            dbCommand.CommandText = string.Format("Update BudgetStudents Set Scolarship={0} Where Id= {1}",
                budgetStudent.Scolarship.ToString(NumberFormatInfo.InvariantInfo), budgetStudent.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#15
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            AuxiliaryWorkersDTO auxiliaryWorker = (AuxiliaryWorkersDTO)tuObject;
            base.Insert(auxiliaryWorker);

            dbCommand.CommandText = string.Format("Insert Into AuxiliaryWorkers(Shift, TypeOfWork) Values({0}, '{1}')",
               auxiliaryWorker.Shift, auxiliaryWorker.TypeOfWork);

            dbCommand.ExecuteNonQuery();
        }
示例#16
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            TeachersDTO teacher = (TeachersDTO)tuObject;
            base.Insert(teacher);

            dbCommand.CommandText = string.Format("Insert Into Teachers(SientistLevel, AmountOfHours) Values('{0}', {1})",
               teacher.SientistLevel, teacher.AmountOfHours);

            dbCommand.ExecuteNonQuery();
        }
示例#17
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            BudgetStudentsDTO budgetStudent = (BudgetStudentsDTO)tuObject;
            base.Insert(budgetStudent);

            dbCommand.CommandText = string.Format("Insert Into BudgetStudents(Scolarship) Values({0})",
               budgetStudent.Scolarship.ToString(NumberFormatInfo.InvariantInfo));

            dbCommand.ExecuteNonQuery();
        }
示例#18
0
        public override void Update(TUObjectsDTO tuObject)
        {
            PaidStudentsDTO paidStudent = (PaidStudentsDTO)tuObject;
            base.Update(paidStudent);

            dbCommand.CommandText = string.Format("Update PaidStudents Set Price={0} Where Id= {1}",
                paidStudent.Price.ToString(NumberFormatInfo.InvariantInfo), paidStudent.Id);

            dbCommand.ExecuteNonQuery();
        }
        public override void Insert(TUObjectsDTO tuObject)
        {
            UniversityLearnersDTO universityLearner = (UniversityLearnersDTO)tuObject;
            base.Insert(universityLearner);

            dbCommand.CommandText = string.Format("Insert Into UniversityLearners(EnteredYear) Values({0})",
               universityLearner.EnteredYear);

            dbCommand.ExecuteNonQuery();
        }
示例#20
0
        public override void Update(TUObjectsDTO tuObject)
        {
            StudentsDTO student = (StudentsDTO)tuObject;
            base.Update(student);

            dbCommand.CommandText = string.Format("Update Students Set LearningForm='{0}', AverageSessionMark={1} Where Id= {2}",
                student.LearningForm, student.AverageSessionMark.ToString(NumberFormatInfo.InvariantInfo), student.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#21
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            StudentsDTO student = (StudentsDTO)tuObject;
            base.Insert(student);

            dbCommand.CommandText = string.Format("Insert Into Students(LearningForm, AverageSessionMark) Values('{0}', {1})",
               student.LearningForm, student.AverageSessionMark.ToString(NumberFormatInfo.InvariantInfo));

            dbCommand.ExecuteNonQuery();
        }
示例#22
0
        public override void Update(TUObjectsDTO tuObject)
        {
            EntrantsDTO entrant = (EntrantsDTO)tuObject;
            base.Update(entrant);

            dbCommand.CommandText = string.Format("Update Entrants Set MarkSum={0}, Privilee='{1}' Where Id= {2}",
                entrant.MarkSum, entrant.Privilege, entrant.Id);

            dbCommand.ExecuteNonQuery();
        }
示例#23
0
        public override void Insert(TUObjectsDTO tuObject)
        {
            EntrantsDTO entrant = (EntrantsDTO)tuObject;
            base.Insert(entrant);

            dbCommand.CommandText = string.Format("Insert Into Entrants(MarkSum, Privilee) Values({0}, '{1}')",
                entrant.MarkSum, entrant.Privilege);

            dbCommand.ExecuteNonQuery();
        }
示例#24
0
        public TUObjectsDTO(TUObjectsDTO tuObject)
        {
            LabelsText = new List<string>();
            LabelsText.Add("Name");
            LabelsText.Add("InputDate");

            ReferencedField = new List<ReferenceInfo>();

            Id = tuObject.Id;
            ClassId = tuObject.ClassId;
            Major = tuObject.Major;
            Name = tuObject.Name;
            InputDate = tuObject.InputDate;
        }
示例#25
0
        public ViewDataClient()
        {
            tuObject = new TUObjects();
            tuObjectData = new TUObjectsDTO();
            dbAction = DBAction.Edit;

            listEnteredValues = new List<string>();
            referencedFieldsIds = new List<int>();

            listLabels = new List<Label>();
            listTextBoxes = new List<TextBox>();
            listButtons = new List<Button>();

            InitializeComponent();
        }
示例#26
0
        public ViewDataClient(TUObjects tuObject, TUObjectsDTO tuObjectData, DBAction dbAction)
        {
            this.tuObject = tuObject;
            this.tuObjectData = tuObjectData;
            this.dbAction = dbAction;

            listEnteredValues = new List<string>();
            referencedFieldsIds = new List<int>();

            listLabels = new List<Label>();
            listTextBoxes = new List<TextBox>();
            listButtons = new List<Button>();

            InitializeComponent();
        }
示例#27
0
 public virtual void Insert(TUObjectsDTO tuObject)
 {
     dbCommand.CommandText = string.Format("Insert Into TUObjects(ClassId, Major, Name, InputDate) Values({0}, {1}, '{2}', '{3}')",
         tuObject.ClassId, tuObject.Major, tuObject.Name, tuObject.InputDate);
     dbCommand.ExecuteNonQuery();
 }
示例#28
0
        private void VeiwDataClient_Load(object sender, EventArgs e)
        {
            if (dbAction == DBAction.Edit)
            {
                int id = tuObjectData.Id;
                tuObjectData = tuObject.Select(id);
            }

            List<string> listNames = tuObjectData.LabelsText;
            List<string> listValues = tuObjectData.GetValues();

            List<ReferenceInfo> listRefInfo = tuObjectData.ReferencedField;

            int yPosition = 10;

            for (int i = 0; i < listNames.Count; i++)
            {
                Label labelTmp = new Label();
                labelTmp.Size = new System.Drawing.Size(80, 20);
                labelTmp.Location = new Point(10, yPosition);
                labelTmp.Text = listNames[i]+":";

                listLabels.Add(labelTmp);
                Controls.Add(labelTmp);

                TextBox textBoxTmp = new TextBox();
                textBoxTmp.Size = new System.Drawing.Size(150, 20);
                textBoxTmp.Location = new Point(90, yPosition);
                textBoxTmp.TabIndex = i;
                if(dbAction == DBAction.Edit)
                    textBoxTmp.Text = listValues[i];
                else
                    textBoxTmp.Text = string.Empty;

                listTextBoxes.Add(textBoxTmp);
                Controls.Add(textBoxTmp);

                yPosition += 40;
            }

            //ref buttons
            //int fieldId;

            //foreach (ReferenceInfo item in listRefInfo)
            //{
            //    referencedFieldsIds.Add(item.FieldNumber);
            //    listEnteredValues

            //    fieldId = Convert.ToInt32(listValues[item.FieldNumber]);
            //    listTextBoxes[item.FieldNumber].Text = tuObject.GetNameById(fieldId);

            //    Button buttonReference = new Button();
            //    buttonReference.Text = "Change";
            //    buttonReference.Size = new Size(80, 23);
            //    buttonReference.Location = new Point(250, (listTextBoxes[item.FieldNumber]).Location.Y);

            //    listButtons.Add(buttonReference);
            //    Controls.Add(buttonReference);
            //}

            //ok cancel buttons
            buttonOK.Location = new Point(110, yPosition);
            buttonOK.TabIndex = listNames.Count;

            buttonCancel.Location = new Point(210, yPosition);
            buttonCancel.TabIndex = listNames.Count + 1;

            this.ClientSize = new Size(ClientSize.Width, ClientSize.Height + 10);
        }
示例#29
0
        public virtual TUObjectsDTO Select(int id)
        {
            dbCommand.CommandText = string.Format("Select Id, ClassId, Major, Name, InputDate From TUObjects Where Id = {0}", id);
            dataReader = dbCommand.ExecuteReader();
            dataReader.Read();

            TUObjectsDTO tuObject = new TUObjectsDTO()
            {
                Id = dataReader.GetInt32(0),
                ClassId = dataReader.GetInt32(1),
                Major = dataReader.GetInt32(2),
                Name = dataReader.GetString(3),
                InputDate = DataConverter.DateTimeToString(dataReader.GetDateTime(4))
            };

            dataReader.Close();
            return tuObject;
        }
示例#30
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //string connectionStringName = ((TreeNodeData)(clickNode.Tag)).ConnectionStringName;
            //string providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName;

            //switch (providerName)
            //{
            //    case "System.Data.SqlClient":
            //        {
            //            dbConnection = sqlConnection;
            //            dbCommand = sqlCommand;

            //            dbConnectionDaughter = sqlConnectionDaughter;
            //            dbCommandDaughter = sqlCommandDaughter;

            //            break;
            //        }
            //    case "FirebirdSql.Data.FirebirdClient":
            //        {
            //            dbConnection = fbConnection;
            //            dbCommand = fbCommand;

            //            dbConnectionDaughter = fbConnectionDaughter;
            //            dbCommandDaughter = fbCommandDaughter;

            //            break;
            //        }
            //    default:
            //        {
            //            throw new Exception("Bad  name of current connection string");
            //        }
            //}

            dbConnection.Open();

            TUObjectsDTO tuObjectData = new TUObjectsDTO()
            {
                Id = ((TreeNodeData)(clickNode.Tag)).Id

            };

            dbCommand.CommandText = "Select ClassId From TUObjects Where Id = " + tuObjectData.Id;
            int classId = (int)dbCommand.ExecuteScalar();

            dbCommand.CommandText = "Select FormName From Classes_ Where ClassId = " + classId;
            string className = (string)dbCommand.ExecuteScalar();

            TUObjects tuObject;
            Type t = Type.GetType(DefinedConstants.logicLeyerNameSpace+ "." + className+", "+DefinedConstants.logicLeyerNameSpace);

            tuObject = (TUObjects)Activator.CreateInstance(t, dbConnection, dbServer);

            //showing dialog

            ViewDataClient editDialog = new ViewDataClient(tuObject, tuObjectData, DBAction.Edit);
            if (editDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                clickNode.Text = editDialog.TuObjectName;
            }

            dbConnection.Close();
        }