private void ResolverUpdatingRow(object sender, UpdatingEventArgs e)
 {
     if (e.Status == UpdateKind.Insert && e.InvokeMethod == UpdateKind.Update)
     {
         e.Row[ParentKey] = fParentKey;
     }
 }
Exemple #2
0
 private void MainResolver_UpdatedRow(object sender, UpdatingEventArgs e)
 {
     if (fDataPicker == null)
     {
         return;
     }
     RecordLogUtil.LogRecord(MainResolver, fDataPicker, e, fLogResults);
 }
Exemple #3
0
        private void MainResolver_UpdatedRow(object sender, UpdatingEventArgs e)
        {
            TableResolver resolver = sender.Convert <TableResolver>();
            Tuple <IRecordDataPicker, List <RecordLogData> > recordLogInfo;

            if (fRecordLogs.TryGetValue(resolver.TableName, out recordLogInfo))
            {
                RecordLogUtil.LogRecord(resolver, recordLogInfo.Item1, e, recordLogInfo.Item2);
            }
        }
 private void MainResolver_UpdatedRow(object sender, UpdatingEventArgs e)
 {
     if (fDataPicker == null)
     {
         return;
     }
     RecordLogUtil.LogRecord(MainResolver, fDataPicker, e, fLogResults);
     //var result = fDataPicker.PickData(e);
     //if (result != null)
     //{
     //    RecordLogData log = new RecordLogData(MainResolver.TableName,
     //        e.InvokeMethod, e.Status, result);
     //    fLogResults.Add(log);
     //}
 }
Exemple #5
0
 public static void LogRecord(TableResolver resolver, IRecordDataPicker dataPicker,
                              UpdatingEventArgs e, List <RecordLogData> logList)
 {
     try
     {
         var result = dataPicker.PickData(resolver, e);
         if (result != null)
         {
             RecordLogData log = new RecordLogData(resolver.TableName,
                                                   e.InvokeMethod, e.Status, result);
             logList.Add(log);
         }
     }
     catch
     {
     }
 }
Exemple #6
0
        private void UpdateRow(UpdatingEventArgs e)
        {
            if (AutoUpdateKey)
            {
                if (e.Status == UpdateKind.Insert)
                {
                    e.Row[KeyField] = CreateUniId();
                }
            }
            if (AutoTrackField)
            {
                UpdateTrackField(e.Status, e.Row);
            }

            OnUpdatingRow(e);
            OnUpdatedRow(e);
        }
        protected override void OnUpdatedRow(UpdatingEventArgs e)
        {
            base.OnUpdatedRow(e);

            if (e.Status == UpdateKind.Insert)
            {
                if (AutoCreatekey)
                {
                    e.Row[DecoderConst.CODE_NICK_NAME] = fCreator.CreateId(Context, TableName);
                }
                if (string.IsNullOrEmpty(e.Row["Py"].ToString()))
                {
                    e.Row["Py"] = PinYinUtil.GetPyHeader(
                        e.Row[DecoderConst.NAME_NICK_NAME].ToString(), string.Empty);
                }
            }
        }
Exemple #8
0
 private void SetSimpleMasterFieldValue(object sender, UpdatingEventArgs e)
 {
     switch (e.Status)
     {
     case UpdateKind.Insert:
     case UpdateKind.Update:
         DataRow detailRow = fDetailResolver.HostTable.Rows[0];
         if (fDetailFields.Length == 1)
         {
             e.Row[fMasterFields[0]] = detailRow[fDetailFields[0]];
         }
         else
         {
             for (int i = 0; i < fMasterFields.Length; ++i)
             {
                 e.Row[fMasterFields[i]] = detailRow[fDetailFields[i]];
             }
         }
         break;
     }
 }
Exemple #9
0
        protected override void OnUpdatingRow(UpdatingEventArgs e)
        {
            base.OnUpdatingRow(e);

            DbTreeDefinition def = fTreeScheme.TreeDefinition;

            switch (e.Status)
            {
            case UpdateKind.Insert:
                if (string.IsNullOrEmpty(e.Row[def.ParentIdField].ToString()))
                {
                    e.Row[def.ParentIdField] = def.ExecuteRootId;
                }
                e.Row[def.LeafField]  = 1;
                e.Row[def.LayerField] = TreeUtil.GetLayer(this, def, e.Row[def.ParentIdField].ToString());
                break;

            case UpdateKind.Update:
                if (IsFakeDelete && e.InvokeMethod == UpdateKind.Delete)
                {
                    if (e.Row[def.LeafField].Value <int>() == 0)
                    {
                        throw new WebPostException("该节点下还有子节点,不能删除!");
                    }
                    TreeUtil.SetParentLeaf(this, def, e.Row[def.ParentIdField].ToString());
                }
                break;

            case UpdateKind.Delete:
                if (e.Row[def.LeafField].Value <int>() == 0)
                {
                    throw new WebPostException("该节点下还有子节点,不能删除!");
                }
                SetCommands(AdapterCommand.Update);
                TreeUtil.SetParentLeaf(this, def, e.Row[def.ParentIdField].ToString());
                break;
            }
        }
Exemple #10
0
        protected virtual void OnUpdatedRow(UpdatingEventArgs e)
        {
            TkDebug.AssertArgumentNull(e, "e", this);

            EventUtil.ExecuteEventHandler(fEventHandlers, UpdatedRowEvent, this, e);
        }