Exemplo n.º 1
0
 internal static void Verify(error_value error)
 {
     if (error.number == "0")
     {
         return;
     }
     throw new SugarException(error);
 }
Exemplo n.º 2
0
    private string Logout(string session)
    {
        error_value errorValue = _sugarsoap.logout(session);
        string      str        = "Logout Successful!";

        if (errorValue.number != "0")
        {
            str = "Logout Error: ";
            str = (str + errorValue.number + "\n") + errorValue.description;
        }
        return(str);
    }
Exemplo n.º 3
0
    public string RelateRecord(string parent, string parentId, string child, string childId)
    {
        parent = ConvertToProper(parent);
        child  = ConvertToProper(child);
        var value = new set_relationship_value();

        value.module1    = parent;
        value.module1_id = parentId;
        value.module2    = child;
        value.module2_id = childId;
        error_value value2 = _sugarsoap.set_relationship(_session, value);

        return(value2.number + ":" + value2.description);
    }
Exemplo n.º 4
0
    public string[] GetAvailableModules()
    {
        module_list list  = _sugarsoap.get_available_modules(_session);
        error_value error = list.error;

        VerifySugarResult.Verify(error);
        int length = 1;

        if (list.modules.Length > 0)
        {
            length = list.modules.Length;
        }
        var strArray = new string[length];
        int index    = 0;

        foreach (string str in list.modules)
        {
            strArray[index] = str;
            index++;
        }
        return(strArray);
    }
Exemplo n.º 5
0
 public module_list()
 {
     modules = new string[0];
     error   = new error_value();
 }
Exemplo n.º 6
0
 public module_fields()
 {
     module_name    = String.Empty;
     module_fields1 = new field[0];
     error          = new error_value();
 }
Exemplo n.º 7
0
 public get_relationships_result()
 {
     ids   = new id_mod[0];
     error = new error_value();
 }
Exemplo n.º 8
0
 public get_entry_result()
 {
     field_list = new field      [0];
     entry_list = new entry_value[0];
     error      = new error_value();
 }
Exemplo n.º 9
0
 public get_entry_list_result_encoded()
 {
     result_count = 0;
     next_offset  = 0;
     total_count  = 0;
     field_list   = new string[0];
     entry_list   = String.Empty;
     error        = new error_value();
 }
Exemplo n.º 10
0
 internal static void Verify(error_value error)
 {
     if (error.number == "0")
         return;
     throw new SugarException(error);
 }
Exemplo n.º 11
0
 public set_entry_result()
 {
     id    = String.Empty;
     error = new error_value();
 }
Exemplo n.º 12
0
        public error_value relate_note_to_module(string session, string note_id, string module_name, string module_id)
        {
            Guid   gUSER_ID     = GetSessionUserID(session);
            Guid   gNOTE_ID     = Sql.ToGuid(note_id);
            string sPARENT_TYPE = module_name;
            Guid   gPARENT_ID   = Guid.Empty;
            Guid   gCONTACT_ID  = Guid.Empty;
            if ( String.Compare(sPARENT_TYPE, "Contacts", true) == 0 )
                gCONTACT_ID = Sql.ToGuid(module_id);
            else
                gPARENT_ID = Sql.ToGuid(module_id);

            int nACLACCESS = Security.GetUserAccess("Notes", "edit");
            if ( nACLACCESS < 0 )
            {
                L10N L10n = new L10N("en-US");
                throw(new Exception(L10n.Term("ACL.LBL_INSUFFICIENT_ACCESS")));
            }

            error_value results = new error_value();
            DbProviderFactory dbf = DbProviderFactories.GetFactory();
            using ( IDbConnection con = dbf.CreateConnection() )
            {
                con.Open();
                string sSQL;
                sSQL = "select *           " + ControlChars.CrLf
                     + "  from vwNOTES_Edit" + ControlChars.CrLf
                     + " where ID = @ID    " + ControlChars.CrLf;
                using ( IDbCommand cmd = con.CreateCommand() )
                {
                    cmd.CommandText = sSQL;
                    Sql.AddParameter(cmd, "@ID", gNOTE_ID);
                    using ( IDataReader rdr = cmd.ExecuteReader() )
                    {
                        if ( rdr.Read() )
                        {
                            string sNAME             = Sql.ToString(rdr["NAME"            ]);
                            string sDESCRIPTION      = Sql.ToString(rdr["DESCRIPTION"     ]);
                            // 09/01/2006 Paul.  Notes do not have an ASSIGNED_USER_ID.
                            Guid   gASSIGNED_USER_ID = Guid.Empty;  // Sql.ToGuid  (rdr["ASSIGNED_USER_ID"]);
                            if ( nACLACCESS != ACL_ACCESS.OWNER || (nACLACCESS == ACL_ACCESS.OWNER  && gASSIGNED_USER_ID == gUSER_ID) )
                            {
                                SqlProcs.spNOTES_Update
                                    ( ref gNOTE_ID
                                    , sNAME
                                    , sPARENT_TYPE
                                    , gPARENT_ID
                                    , gCONTACT_ID
                                    , sDESCRIPTION
                                    , Sql.ToGuid(rdr["TEAM_ID"])
                                    );
                            }
                        }
                    }
                }
            }

            return results;
        }
Exemplo n.º 13
0
 public error_value logout(string session)
 {
     Guid gUSER_ID = GetSessionUserID(session);
     error_value results = new error_value();
     return results;
 }
Exemplo n.º 14
0
 public SugarException(error_value error)
 {
     _error = error;
 }
Exemplo n.º 15
0
 public SugarException(error_value error)
 {
     _error = error;
 }
Exemplo n.º 16
0
 public return_note_attachment()
 {
     note_attachment = new note_attachment();
     error           = new error_value();
 }
Exemplo n.º 17
0
 public set_entries_result()
 {
     ids   = new string[0];
     error = new error_value();
 }
Exemplo n.º 18
0
        public error_value set_relationship(string session, set_relationship_value set_relationship_value)
        {
            Guid gUSER_ID = GetSessionUserID(session);

            // 02/16/2006 Paul.  Don't need to verify the modules as it will be done inside SetRelationship();
            //VerifyModuleName(set_relationship_value.module1);
            //VerifyModuleName(set_relationship_value.module2);
            int nACLACCESS = Security.GetUserAccess(set_relationship_value.module1, "edit");
            if ( nACLACCESS < 0 )
            {
                L10N L10n = new L10N("en-US");
                throw(new Exception(L10n.Term("ACL.LBL_INSUFFICIENT_ACCESS")));
            }

            error_value results = new error_value();
            SetRelationship(set_relationship_value.module1, set_relationship_value.module1_id, set_relationship_value.module2, set_relationship_value.module2_id);
            return results;
        }
Exemplo n.º 19
0
 public set_relationship_list_result()
 {
     created = 0;
     failed  = 0;
     error   = new error_value();
 }
Exemplo n.º 20
0
 public get_entry_list_result()
 {
     result_count = 0;
     next_offset  = 0;
     field_list   = new field      [0];
     entry_list   = new entry_value[0];
     error        = new error_value();
 }