コード例 #1
0
ファイル: DayControl.cs プロジェクト: EsleEnoemos/HappyIndex2
 /// <summary>
 /// Initializes a new instance of the <b>DayControl</b> class.
 /// </summary>
 /// <param name="hi"></param>
 public DayControl( HappyIndex hi )
 {
     InitializeComponent();
     this.hi = hi ?? new HappyIndex { Date = DateTime.Now };
 }
コード例 #2
0
 public ProductionControl( HappyIndex hi )
 {
     this.hi = hi ?? new HappyIndex();
     InitializeComponent();
 }
コード例 #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sid"></param>
 /// <param name="hi"></param>
 /// <returns></returns>
 public static HappyIndex UpdateHappyIndex( string sid, HappyIndex hi )
 {
     User user = GetUser();
     using( DBCommand cmd = new DBCommand( Con, CommandType.StoredProcedure ) ) {
         cmd.CommandText = "UpdateHappyIndex";
         SqlParameter id = cmd.Add( "@HappyIndex_ID", SqlDbType.Int, ParameterDirection.InputOutput, hi.ID );
         cmd.AddWithValue( "@User_ID", user.ID );
         cmd.AddWithValue( "@Date", hi.Date.Format() );
         cmd.AddWithValue( "@EmotionalIndex", hi.EmotionalIndex );
         cmd.AddWithValue( "@EmotionalComment", Z( hi.EmotionalComment ) );
         cmd.AddWithValue( "@ProductivityIndex", hi.ProductivityIndex );
         cmd.AddWithValue( "@MotivationIndex", hi.MotivationIndex );
         cmd.AddWithValue( "@IndexComment", Z( hi.IndexComment ) );
         cmd.ExecuteNonQuery();
         if( hi.ID <= 0 ) {
             hi.ID = (int)id.Value;
         }
     }
     foreach( Team t in user.Teams ) {
         string filenameFilter = string.Format( "{0}_Teams_{1}_*", hi.Date.Year, t.ID );
         FileInfo[] files = GraphicsHandler.SaveDir.GetFiles( filenameFilter );
         for( int i = 0; i < files.Length; i++ ) {
             FileInfo file = files[ i ];
             try {
                 file.Delete();
             } catch { }
         }
     }
     string userFilenameFilter = string.Format( "{0}_User_{1}_*", hi.Date.Year, user.ID );
     FileInfo[] userFiles = GraphicsHandler.SaveDir.GetFiles( userFilenameFilter );
     for( int i = 0; i < userFiles.Length; i++ ) {
         FileInfo file = userFiles[ i ];
         try {
             file.Delete();
         } catch { }
     }
     return hi;
 }