public override void RemoveAt(int idx)
        {
            IGxSilentTrnGridItem item = (IGxSilentTrnGridItem)(this[idx]);

            if (StringUtil.StrCmp(item.gxTpr_Mode, "INS") == 0)
            {
                base.RemoveAt(idx);
            }
            else
            {
                item.gxTpr_Mode = "DLT";
            }
            return;
        }
        public override void RemoveItem(int idx)
        {
            if (idx <= 0 || idx > Count)
            {
                return;
            }

            IGxSilentTrnGridItem item = (IGxSilentTrnGridItem)(this[idx - 1]);

            if (StringUtil.StrCmp(item.gxTpr_Mode, TRANSACTION_MODE.INSERT) == 0)
            {
                base.RemoveAt(idx - 1);
            }
            else
            {
                item.gxTpr_Mode = "DLT";
            }
            return;
        }
Beispiel #3
0
 public void CopyFrom(GxGenericCollectionItem <T> source)
 {
     foreach (PropertyInfo info in source.GetType().GetProperties())
     {
         if (info.CanRead && info.Name.StartsWith("gxTpr_"))
         {
             if (info.PropertyType.BaseType.Name.StartsWith("List"))
             {
                 object thisCollection = info.GetValue(this, null);
                 foreach (object item in (IList)thisCollection)
                 {
                     PropertyInfo         itemInfo  = item.GetType().GetProperty("sdt");
                     IGxSilentTrnGridItem bcColItem = (IGxSilentTrnGridItem)itemInfo.GetValue(item, null);
                     bcColItem.gxTpr_Mode     = "DLT";
                     bcColItem.gxTpr_Modified = 1;
                 }
                 object sourceCollection = info.GetValue(source, null);
                 info.SetValue(this, sourceCollection, null);
             }
             else
             {
                 if (info.GetCustomAttributes(typeof(GxUpload), false).Length > 0)
                 {
                     string uploadPath = (string)info.GetValue(source, null);
                     if (GxUploadHelper.IsUpload(uploadPath))                             //File upload from SD
                     {
                         info.SetValue(this, GxUploadHelper.UploadPath(uploadPath), null);
                         PropertyInfo info_gxi = source.Sdt.GetType().GetProperty(info.Name + "_gxi");                                //gxi reset
                         if (info_gxi != null)
                         {
                             info_gxi.SetValue(this.Sdt, string.Empty, null);
                         }
                     }
                     else if (PathUtil.IsAbsoluteUrl(uploadPath))                             //External url from SD
                     {
                         PropertyInfo info_gxi = source.Sdt.GetType().GetProperty(info.Name + "_gxi");
                         if (info_gxi != null)
                         {
                             info_gxi.SetValue(this.Sdt, uploadPath, null);
                         }
                         info.SetValue(this, string.Empty, null);
                     }
                     else if (string.IsNullOrEmpty(uploadPath))
                     {
                         PropertyInfo info_gxi = source.Sdt.GetType().GetProperty(info.Name + "_gxi");
                         if (info_gxi != null)
                         {
                             info_gxi.SetValue(this.Sdt, string.Empty, null);
                         }
                         info.SetValue(this, string.Empty, null);
                     }
                 }
                 else
                 {
                     object o = info.GetValue(source, null);
                     info.SetValue(this, o, null);
                 }
             }
         }
     }
 }