Ejemplo n.º 1
0
        public void SaveDetailRow()
        {
            if (SelectedDetailRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedDetailRow, new ValidationContext(SelectedDetailRow, null, null), valiationCollection, true);

                if (isvalid)
                {
                    var rowToSave = new TblAccSize();
                    rowToSave.InjectFrom(SelectedDetailRow);
                    Client.UpdateOrInsertTblAccSizeCodeAsync(rowToSave, SelectedMainRow.DetailsList.IndexOf(SelectedDetailRow));
                }
            }
        }
Ejemplo n.º 2
0
        private TblAccSize DeleteTblAccSizeCode(TblAccSize row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblAccSizes
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row);
        }
Ejemplo n.º 3
0
        private TblAccSize UpdateOrInsertTblAccSizeCode(TblAccSize newRow, int index, out int outindex)
        {
            outindex = index;
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblAccSizes
                              where e.Iserial == newRow.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    GenericUpdate(oldRow, newRow, context);
                }
                else
                {
                    context.TblAccSizes.AddObject(newRow);
                }

                context.SaveChanges();
                return(newRow);
            }
        }