private void btn_submit_Click(object sender, RoutedEventArgs e)
        {
            if (gridPrice.SelectedItems.Count != 1)
            {
                return;
            }
            P_Price p = gridPrice.SelectedItem as P_Price;
            Reckon  r = Db.QueryReckonByAssignId(p.AssignId).Single();

            try
            {
                r.Count = int.Parse(txt_Count.Text);
                if (r.Count < 0)
                {
                    SystemSounds.Beep.Play();
                    MessageBox.Show("计件数量不能小于零!");
                    return;
                }
                Db.UpdateReckonCount(r);
                p.IsSubmited = true;
            }
            catch
            {
                SystemSounds.Beep.Play();
                MessageBox.Show("提交失败!");
                return;
            }
        }
Esempio n. 2
0
 public int UpdateReckonCount(Reckon r)
 {
     using (IDbConnection conn = OpenConnection())
     {
         return(conn.Execute("update tbl_Reckon set Count=@Count where Assign_Id=@Assign_Id", new { Count = r.Count, Assign_Id = r.Assign_Id }));
     }
 }
        private void gridPrice_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (gridPrice.SelectedItems.Count != 1)
            {
                return;
            }
            P_Price p = gridPrice.SelectedItem as P_Price;
            Reckon  r = Db.QueryReckonByAssignId(p.AssignId).Single();

            txt_Count.Text = r.Count.ToString();
        }
Esempio n. 4
0
 public int InsertReckon(Reckon r)
 {
     //Assign_Id INT PRIMAEY KEY,
     //CONSTRAINT fk_Assign_Id FOREIGN KEY (Assign_Id)
     //    REFERENCES tbl_Assign (Id) ON DELETE CASCADE ON UPDATE CASCADE,
     //Price_Id INT,
     //CONSTRAINT fk_Price_Id FOREIGN KEY (Price_Id)
     //    REFERENCES tbl_Value_Price (Id) ON DELETE CASCADE ON UPDATE CASCADE,
     //Count INT
     using (IDbConnection conn = OpenConnection())
     {
         return(conn.Execute("Insert into tbl_Reckon values "
                             + "(@Assign_Id, @Count)",
                             new { Assign_Id = r.Assign_Id, Count = r.Count }));
     }
 }
Esempio n. 5
0
        private void btn_AddRelationship_Click(object sender, RoutedEventArgs e)
        {
            Assign a = new Assign();

            a.EmployeeId = (cmb_Employee.SelectedItem as Employee).Id;
            a.Price_Id   = SelectedPrice.Id;
            if (Db.QueryAssignWhetherExsit(a).Count() > 0)
            {
                SystemSounds.Beep.Play();
                string str = "该员工已被分配到此工序!";
                MessageBox.Show(str);
                return;
            }
            Db.InsertAssign(a);
            Assign a0 = Db.QueryAssignWhetherExsit(a).Single();
            Reckon r  = new Reckon();

            r.Assign_Id = a0.Id;
            r.Count     = 0;
            Db.InsertReckon(r);
            PsPage.FillEmployee();
            this.Close();
        }