Ejemplo n.º 1
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcSYS_UserRole)
     {
         bcSYS_UserRole = (SdtSYS_UserRole)(sdt);
         if (StringUtil.StrCmp(bcSYS_UserRole.gxTpr_Mode, "") == 0)
         {
             bcSYS_UserRole.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow43(bcSYS_UserRole);
         }
         else
         {
             RowToVars43(bcSYS_UserRole, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcSYS_UserRole.gxTpr_Mode, "") == 0)
         {
             bcSYS_UserRole.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 2
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcwwpbaseobjects_SecFunctionalityRole)
     {
         bcwwpbaseobjects_SecFunctionalityRole = (GeneXus.Programs.wwpbaseobjects.SdtSecFunctionalityRole)(sdt);
         if (StringUtil.StrCmp(bcwwpbaseobjects_SecFunctionalityRole.gxTpr_Mode, "") == 0)
         {
             bcwwpbaseobjects_SecFunctionalityRole.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow2(bcwwpbaseobjects_SecFunctionalityRole);
         }
         else
         {
             RowToVars2(bcwwpbaseobjects_SecFunctionalityRole, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcwwpbaseobjects_SecFunctionalityRole.gxTpr_Mode, "") == 0)
         {
             bcwwpbaseobjects_SecFunctionalityRole.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 3
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcSYS_RolePermission)
     {
         bcSYS_RolePermission = (SdtSYS_RolePermission)(sdt);
         if (StringUtil.StrCmp(bcSYS_RolePermission.gxTpr_Mode, "") == 0)
         {
             bcSYS_RolePermission.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow61(bcSYS_RolePermission);
         }
         else
         {
             RowToVars61(bcSYS_RolePermission, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcSYS_RolePermission.gxTpr_Mode, "") == 0)
         {
             bcSYS_RolePermission.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 4
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcBR_PatientReEntity)
     {
         bcBR_PatientReEntity = (SdtBR_PatientReEntity)(sdt);
         if (StringUtil.StrCmp(bcBR_PatientReEntity.gxTpr_Mode, "") == 0)
         {
             bcBR_PatientReEntity.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow63(bcBR_PatientReEntity);
         }
         else
         {
             RowToVars63(bcBR_PatientReEntity, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcBR_PatientReEntity.gxTpr_Mode, "") == 0)
         {
             bcBR_PatientReEntity.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 5
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcSYS_TenantUser)
     {
         bcSYS_TenantUser = (SdtSYS_TenantUser)(sdt);
         if (StringUtil.StrCmp(bcSYS_TenantUser.gxTpr_Mode, "") == 0)
         {
             bcSYS_TenantUser.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow45(bcSYS_TenantUser);
         }
         else
         {
             RowToVars45(bcSYS_TenantUser, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcSYS_TenantUser.gxTpr_Mode, "") == 0)
         {
             bcSYS_TenantUser.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 6
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcBAS_DataPackage)
     {
         bcBAS_DataPackage = (SdtBAS_DataPackage)(sdt);
         if (StringUtil.StrCmp(bcBAS_DataPackage.gxTpr_Mode, "") == 0)
         {
             bcBAS_DataPackage.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow55(bcBAS_DataPackage);
         }
         else
         {
             RowToVars55(bcBAS_DataPackage, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcBAS_DataPackage.gxTpr_Mode, "") == 0)
         {
             bcBAS_DataPackage.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 7
0
 public void SetSDT(GxSilentTrnSdt sdt,
                    short sdtToBc)
 {
     if (sdt != bcwwpbaseobjects_UserCustomizations)
     {
         bcwwpbaseobjects_UserCustomizations = (GeneXus.Programs.wwpbaseobjects.SdtUserCustomizations)(sdt);
         if (StringUtil.StrCmp(bcwwpbaseobjects_UserCustomizations.gxTpr_Mode, "") == 0)
         {
             bcwwpbaseobjects_UserCustomizations.gxTpr_Mode = "INS";
         }
         if (sdtToBc == 1)
         {
             VarsToRow8(bcwwpbaseobjects_UserCustomizations);
         }
         else
         {
             RowToVars8(bcwwpbaseobjects_UserCustomizations, 1);
         }
     }
     else
     {
         if (StringUtil.StrCmp(bcwwpbaseobjects_UserCustomizations.gxTpr_Mode, "") == 0)
         {
             bcwwpbaseobjects_UserCustomizations.gxTpr_Mode = "INS";
         }
     }
     return;
 }
Ejemplo n.º 8
0
        public override Task Post()
        {
            try
            {
                if (!IsAuthenticated())
                {
                    return(null);
                }
                bool gxcheck          = IsRestParameter(CHECK_PARAMETER);
                bool gxinsertorupdate = IsRestParameter(INSERT_OR_UPDATE_PARAMETER);

                GxSilentTrnSdt entity           = (GxSilentTrnSdt)Activator.CreateInstance(_worker.GetType(), new Object[] { _gxContext });
                var            entity_interface = MakeRestType(entity);
                entity_interface = ReadRequestBodySDTObj(entity_interface.GetType());

                var worker_interface = MakeRestType(_worker);

                worker_interface.GetType().GetMethod("CopyFrom").Invoke(worker_interface, new object[] { entity_interface });
                if (gxcheck)
                {
                    _worker.Check();
                }
                else
                {
                    if (gxinsertorupdate)
                    {
                        _worker.InsertOrUpdate();
                    }
                    else
                    {
                        _worker.Save();
                    }
                }
                if (_worker.Success())
                {
                    if (!gxcheck)
                    {
                        _worker.trn.context.CommitDataStores();
                        SetStatusCode(HttpStatusCode.Created);
                    }
                    SetMessages(_worker.trn.GetMessages());
                    return(Serialize(MakeRestType(_worker)));
                }
                else
                {
                    Cleanup();
                    return(ErrorCheck(_worker.trn));
                }
            }
            catch (Exception e)
            {
                return(WebException(e));
            }
            finally
            {
                Cleanup();
            }
        }
Ejemplo n.º 9
0
        private IndexRecord GetIndexRecord(object obj, GxContentInfo contentInfo)
        {
            IndexRecord    ir     = null;
            GxFile         file   = obj as GxFile;
            GxSilentTrnSdt silent = obj as GxSilentTrnSdt;
            string         str    = obj as string;

            if (file != null && contentInfo != null)
            {
                ir         = new IndexRecord();
                ir.Uri     = file.GetAbsoluteName();
                ir.Content = DocumentHandler.GetText(file.GetAbsoluteName(), Path.GetExtension(file.GetAbsoluteName()));
                ir.Entity  = contentInfo.Entity == null?file.GetType().ToString() : contentInfo.Entity;

                ir.Title = contentInfo.Title == null?file.GetName() : contentInfo.Title;

                ir.Viewer = contentInfo.Viewer == null?file.GetName() : contentInfo.Viewer;

                ir.Keys = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? new List <string>() : contentInfo.Keys;
            }
            else if (silent != null)
            {
                IGxSilentTrn  bc   = (silent).getTransaction();
                GxContentInfo info = bc.GetContentInfo();
                if (info != null)
                {
                    ir         = new IndexRecord();
                    ir.Uri     = info.Id;
                    ir.Content = bc.ToString();
                    ir.Entity  = contentInfo.Entity == null ? info.Entity : contentInfo.Entity;
                    ir.Title   = contentInfo.Title == null ? info.Title : contentInfo.Title;
                    ir.Viewer  = contentInfo.Viewer == null ? info.Viewer : contentInfo.Viewer;
                    ir.Keys    = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? info.Keys : contentInfo.Keys;
                }
            }
            else if (str != null && contentInfo != null)
            {
                ir         = new IndexRecord();
                ir.Uri     = contentInfo.Id == null ? string.Empty : contentInfo.Id;
                ir.Content = str;
                ir.Entity  = contentInfo.Entity == null ? String.Empty : contentInfo.Entity;
                ir.Title   = contentInfo.Title == null ? String.Empty : contentInfo.Title;
                ir.Viewer  = contentInfo.Viewer == null ? String.Empty : contentInfo.Viewer;
                ir.Keys    = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? new List <string>() : contentInfo.Keys;
            }
            return(ir);
        }
Ejemplo n.º 10
0
 public GXBCRestService(GxSilentTrnSdt sdt, HttpContext context, IGxContext gxContext) : base(context, gxContext)
 {
     _worker = sdt;
 }
Ejemplo n.º 11
0
        public override Task Put(object parameters)
        {
            try
            {
                if (!IsAuthenticated())
                {
                    return(null);
                }
                string[] key = SplitParameters(parameters);
                if (key != null)
                {
                    bool           gxcheck          = IsRestParameter(CHECK_PARAMETER);
                    GxSilentTrnSdt entity           = (GxSilentTrnSdt)Activator.CreateInstance(_worker.GetType(), new Object[] { _gxContext });
                    var            entity_interface = MakeRestType(entity);
                    entity_interface = ReadRequestBodySDTObj(entity_interface.GetType());
                    string entityHash = entity_interface.GetType().GetProperty("Hash").GetValue(entity_interface) as string;

                    ReflectionHelper.CallBCMethod(_worker, LOAD_METHOD, key);
                    var    worker_interface = MakeRestType(_worker);
                    string currentHash      = worker_interface.GetType().GetProperty("Hash").GetValue(worker_interface) as string;
                    if (entityHash == currentHash)
                    {
                        worker_interface.GetType().GetMethod("CopyFrom").Invoke(worker_interface, new object[] { entity_interface });
                        if (gxcheck)
                        {
                            _worker.Check();
                        }
                        else
                        {
                            _worker.Save();
                        }
                        if (_worker.Success())
                        {
                            if (!gxcheck)
                            {
                                _worker.trn.context.CommitDataStores();
                            }
                            SetMessages(_worker.trn.GetMessages());
                            worker_interface.GetType().GetProperty("Hash").SetValue(worker_interface, null);
                            return(Serialize(worker_interface));
                        }
                        else
                        {
                            Cleanup();
                            return(ErrorCheck(_worker.trn));
                        }
                    }
                    else
                    {
                        return(SetError(HttpStatusCode.Conflict.ToString(), _worker.trn.context.GetMessage("GXM_waschg", new object[] { this.GetType().Name })));
                    }
                }
                else
                {
                    return(SetError(((int)HttpStatusCode.NotFound).ToString(), HttpStatusCode.NotFound.ToString()));
                }
            }
            catch (Exception e)
            {
                return(WebException(e));
            }
            finally
            {
                Cleanup();
            }
        }
Ejemplo n.º 12
0
 protected void Deserialize(string value, ref GxSilentTrnSdt sdt)
 {
     sdt.FromJSonString(value);
 }