Ejemplo n.º 1
0
        private void materialButton_changeStatus_Click_1(object sender, EventArgs e)
        {
            int opencountercount = db.counters.Count(o => o.counterstatus == 2);

            if (opencountercount > 0)
            {
                CustomControls.Comformation.show("Day Management", "Please Ensure That all Counter Have been Closed");
                return;
            }

            if (this.Systemsetting == null)
            {
                this.Systemsetting             = new Model.systemsetting();
                this.Systemsetting.currentdate = nepaliCalender.Datestamp;
                this.Systemsetting.dateopened  = true;
                db.systemsettings.Add(this.Systemsetting);
            }
            else
            {
                if (this.Systemsetting.dateopened)
                {
                    if (CustomControls.Comformation.show("Day Management", "Are You Sure, you want To Close Day") == DialogResult.Yes)
                    {
                        this.Systemsetting.dateopened = false;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    if (CustomControls.Comformation.show("Day Management", "Check Following things-\n1.Date is Correct\nPress yes to Open Day ") == DialogResult.Yes)
                    {
                        this.Systemsetting.currentdate = nepaliCalender.Datestamp;
                        this.Systemsetting.dateopened  = true;
                    }
                    else
                    {
                        return;
                    }
                }
                db.Entry(this.Systemsetting).State = System.Data.Entity.EntityState.Modified;
            }

            db.SaveChanges();
            refreshUI();
        }
Ejemplo n.º 2
0
 public Daily_Setting()
 {
     InitializeComponent();
     db = Model.DatabaseConfigure.getConfigure();
     if (db.systemsettings.Count() > 0)
     {
         this.Systemsetting = db.systemsettings.FirstOrDefault();
         refreshUI();
     }
     else
     {
         nepaliCalender.DateTime               = DateTime.Now;
         materialButton_changeStatus.Text      = "Open Day";
         materialButton_changeStatus.BackColor = Color.FromArgb(252, 65, 54);
     }
     instance         = this;
     this.FormClosed += (o, e) =>
     {
         instance = null;
     };
 }
Ejemplo n.º 3
0
 private void materialButton_setDefault_Click(object sender, EventArgs e)
 {
     if (loaded)
     {
         if (db.systemsettings.Count() > 0)
         {
             var setting = db.systemsettings.First();
             setting.fiscalyear_id   = this.Fiscalyear.id;
             db.Entry(setting).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         else
         {
             var setting = new Model.systemsetting()
             {
                 fiscalyear_id = this.Fiscalyear.id
             };
             db.systemsettings.Add(setting);
             db.SaveChanges();
         }
         INFO.ShowAlert("", this.Fiscalyear.name + " set as current Fiscal Year", 3000);
     }
 }