private void btnMinZarplata_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MinimumPay          pay    = new MinimumPay();
         WindowAddMinumumPay window = new WindowAddMinumumPay(pay);
         if (window.ShowDialog() == true)
         {
             //MessageBox.Show(pay.Pay.ToString());
             list.Clear();
             using (var db = new SmetaDbAppContext())
             {
                 db.Posts.ForEach(x =>
                 {
                     x.Pay = pay.Pay;
                     x.Update();
                     list.Add(new PostView(x));
                 });
             }
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.ToString());
     }
 }
Exemple #2
0
        private void OnClickNew(object sender, RoutedEventArgs e)
        {
            MinimumPay pay = new MinimumPay();

            Adds.WindowAddMinumumPay window = new Adds.WindowAddMinumumPay(pay);
            if (window.ShowDialog() == true)
            {
                pay.Status = false;
                list.Add(pay);
                pay.Save();
            }
        }
Exemple #3
0
        private void OnEditing(object sender, RoutedEventArgs e)
        {
            if (data.SelectedItem == null)
            {
                return;
            }
            MinimumPay pay = list[data.SelectedIndex];

            Adds.WindowAddMinumumPay window = new Adds.WindowAddMinumumPay(pay);
            if (window.ShowDialog() == true)
            {
                pay.Update();
            }
        }
Exemple #4
0
 private void DoWok(object sender, DoWorkEventArgs e)
 {
     using (var db = new SmetaDbAppContext())
     {
         MinimumPay MinPay = list.Where(x => x.Status == true).FirstOrDefault();
         // Ishchilarning narxini o'zgartirish
         foreach (var item in db.Posts)
         {
             item.Pay = Math.Round(MinPay.Pay * item.Koef, 2);
             item.Update();
         }
         // Ishlarning narxlarini o'zgartirish
         List <Post>     posts = db.Posts;
         List <WorkTeam> teams = db.WorkTeams;
         int             i     = 1;
         db.Works.ForEach(work =>
         {
             double s = 0;
             teams.Where(group => group.WorkDemId == work.Id).ToList().ForEach(x =>
             {
                 Post post = posts.Where(q => q.Id == x.PostId).FirstOrDefault();
                 s        += Math.Round(post.Pay / 168 * x.Koef * x.Count, 2);
             });
             work.PricePay = s;
             //work.Update();
             string query = "Update Works Set PricePay=" + Helper.ToString(s) + " Where Id=" + work.Id;
             DBConnection.SqlQuery(query);
             (sender as BackgroundWorker).ReportProgress(i, null);
             i++;
         });
         // Minimum zarplatani o'zgartirish
         foreach (var item in list)
         {
             item.Update();
         }
     }
 }
Exemple #5
0
 public MinimumPayView(MinimumPay MinimumPay)
 {
     this.MinimumPay = MinimumPay;
 }
Exemple #6
0
 public WindowAddMinumumPay(MinimumPay pay)
 {
     InitializeComponent();
     DataContext = pay;
 }