Пример #1
0
 private void materialButton_save_Click(object sender, EventArgs e)
 {
     if (loaded)
     {
         this.Fiscalyear.name            = betterTextBox_name.Text;
         this.Fiscalyear.startdate       = nepaliCalender_startdate.Datestamp;
         this.Fiscalyear.enddate         = nepaliCalender_endate.Datestamp;
         this.Fiscalyear.updated_at      = DateTime.Now;
         db.Entry(this.Fiscalyear).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     else
     {
         this.Fiscalyear = new Model.fiscalyear()
         {
             name       = betterTextBox_name.Text,
             startdate  = nepaliCalender_startdate.Datestamp,
             enddate    = nepaliCalender_endate.Datestamp,
             created_at = DateTime.Now,
             updated_at = DateTime.Now,
             admin_id   = INFO.admin_id
         };
         db.fiscalyears.Add(this.Fiscalyear);
         db.SaveChanges();
         loaded = true;
     }
 }
Пример #2
0
 public Viwer(int id)
 {
     InitializeComponent();
     db = Model.DatabaseConfigure.getConfigure();
     this.Fiscalyear                    = db.fiscalyears.Find(id);
     betterTextBox_name.Text            = this.Fiscalyear.name;
     nepaliCalender_startdate.Datestamp = this.Fiscalyear.startdate.Value;
     nepaliCalender_endate.Datestamp    = this.Fiscalyear.enddate.Value;
     loaded = true;
 }