コード例 #1
0
ファイル: ProjectManager.cs プロジェクト: aelhadi/opencbs
        private void _UpdateFollowUp(FollowUp pUp, SqlTransaction pTransaction)
        {
            const string q = @"UPDATE [FollowUp] SET [year] = @year,[CA] = @CA,[Jobs1] = @Jobs1 ,[Jobs2] = @Jobs2
                ,[PersonalSituation] = @PersonalSituation ,[activity] = @activity ,[comment] = @comment WHERE id = @id";

            using (OpenCbsCommand c = new OpenCbsCommand(q, pTransaction.Connection, pTransaction))
            {
                c.AddParam("@id", pUp.Id);
                c.AddParam("@year", pUp.Year);
                c.AddParam("@CA", pUp.CA);
                c.AddParam("@jobs1", pUp.Jobs1);
                c.AddParam("@jobs2", pUp.Jobs2);
                c.AddParam("@personalSituation", pUp.PersonalSituation);
                c.AddParam("@activity", pUp.Activity);
                c.AddParam("@comment", pUp.Comment);
                c.ExecuteNonQuery();
            }
        }
コード例 #2
0
ファイル: ProjectManager.cs プロジェクト: aelhadi/opencbs
        private void _AddFollowUp(FollowUp pUp, int pId, SqlTransaction pTransac)
        {
            const string q = @"INSERT INTO [FollowUp] ([project_id],[year],[CA],[Jobs1],[Jobs2],[PersonalSituation],[activity]
                ,[comment]) VALUES(@projectId,@year,@CA,@jobs1,@jobs2,@personalSituation,@activity,@comment)
                SELECT SCOPE_IDENTITY()";

            using (OpenCbsCommand c = new OpenCbsCommand(q, pTransac.Connection, pTransac))
            {
                c.AddParam("@projectId", pId);
                c.AddParam("@year", pUp.Year);
                c.AddParam("@CA", pUp.CA);
                c.AddParam("@jobs1", pUp.Jobs1);
                c.AddParam("@jobs2", pUp.Jobs2);
                c.AddParam("@personalSituation", pUp.PersonalSituation);
                c.AddParam("@activity", pUp.Activity);
                c.AddParam("@comment", pUp.Comment);
                pUp.Id = Convert.ToInt32(c.ExecuteScalar());
            }
        }
コード例 #3
0
ファイル: ProjectManager.cs プロジェクト: aelhadi/opencbs
 private IEnumerable<FollowUp> SelectFollowUps(int pProjectId)
 {
     List<FollowUp> list = new List<FollowUp>();
     const string sqlText = "SELECT * FROM FollowUp WHERE project_id = @pId";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand select = new OpenCbsCommand(sqlText, conn))
     {
         select.AddParam("@pId", pProjectId);
         using (OpenCbsReader reader = select.ExecuteReader())
         {
             if (reader == null || reader.Empty) return new List<FollowUp>();
             while (reader.Read())
             {
                 FollowUp followUp = new FollowUp();
                 followUp.Id = reader.GetInt("id");
                 followUp.Year = reader.GetInt("year");
                 followUp.Jobs1 = reader.GetInt("Jobs1");
                 followUp.Jobs2 = reader.GetInt("Jobs2");
                 followUp.CA = reader.GetMoney("CA");
                 followUp.PersonalSituation = reader.GetString("PersonalSituation");
                 followUp.Activity = reader.GetString("activity");
                 followUp.Comment = reader.GetString("comment");
                 list.Add(followUp);
             }
             return list;
         }
     }
 }
コード例 #4
0
 private void buttonCancel_Click(object sender, System.EventArgs e)
 {
     _followUp = null;
     Close();
 }
コード例 #5
0
 public ProjectFollowUp(FollowUp pFollowUp)
 {
     InitializeComponent();
     _followUp = pFollowUp;
     _InitializeFollowUp();
 }
コード例 #6
0
 public ProjectFollowUp()
 {
     InitializeComponent();
     _followUp = new FollowUp {Year = 1};
 }